1 parent de45bbc commit 598c8c8Copy full SHA for 598c8c8
1 file changed
src/fromgif.c
@@ -275,7 +275,7 @@ gif_out_code(
275
return;
276
}
277
278
- g->out[g->cur_x + g->cur_y * g->line_size] = g->codes[code].suffix;
+ g->out[g->cur_x + g->cur_y * g->max_x] = g->codes[code].suffix;
279
if (g->cur_x >= g->actual_width) {
280
g->actual_width = g->cur_x + 1;
281
@@ -433,7 +433,7 @@ gif_load_next(
433
y = gif_get16le(s); /* Image Top Position (2 bytes) */
434
w = gif_get16le(s); /* Image Width (2 bytes) */
435
h = gif_get16le(s); /* Image Height (2 bytes) */
436
- if (((x + w) > (g->w)) || ((y + h) > (g->h))) {
+ if (x >= g->w || y >= g->h || x + w > g->w || y + h > g->h) {
437
sixel_helper_set_additional_message(
438
"corrupt GIF (reason: bad Image Separator).");
439
status = SIXEL_RUNTIME_ERROR;
0 commit comments