LibGfx: add bounds checking before set_pixel call in GIF decoder
This fixes a crash when a GIF frame extends beyond the limits of the logical screen, causing writes past the end of the frame buffer
This commit is contained in:
parent
a28f29c82c
commit
5567408bab
Notes:
sideshowbarker
2024-07-19 01:35:40 +09:00
Author: https://github.com/peterdn Commit: https://github.com/SerenityOS/serenity/commit/5567408bab9 Pull-request: https://github.com/SerenityOS/serenity/pull/3899 Issue: https://github.com/SerenityOS/serenity/issues/3484 Reviewed-by: https://github.com/awesomekling
1 changed files with 1 additions and 1 deletions
|
@ -355,7 +355,7 @@ static bool decode_frame(GIFLoadingContext& context, size_t frame_index)
|
|||
int x = pixel_index % image.width + image.x;
|
||||
int y = row + image.y;
|
||||
|
||||
if (!image.transparent || color != image.transparency_index) {
|
||||
if (context.frame_buffer->rect().contains(x, y) && (!image.transparent || color != image.transparency_index)) {
|
||||
context.frame_buffer->set_pixel(x, y, c);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue