Skip to content

Commit

Permalink
LibGfx: add bounds checking before set_pixel call in GIF decoder
Browse files Browse the repository at this point in the history
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
  • Loading branch information
peterdn authored and awesomekling committed Nov 1, 2020
1 parent a28f29c commit 5567408
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Libraries/LibGfx/GIFLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 5567408

Please sign in to comment.