Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix out-of-bounds read access in GIF decoding #46

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mk/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ RM := rm -rf
MKDIR := mkdir -p

__CFLAGS := -Wall -Wextra -pipe
__CFLAGS += -O2 -g -pipe
__CFLAGS += -Og -g -pipe
__CFLAGS += $(CFLAGS)

uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
Expand Down
6 changes: 3 additions & 3 deletions src/image-gif.c
Original file line number Diff line number Diff line change
Expand Up @@ -578,9 +578,7 @@ static twin_animation_t *_twin_animation_from_gif_file(const char *path)
twin_pointer_t p = twin_pixmap_pointer(anim->frames[i], 0, 0);
twin_coord_t row = 0, col = 0;
for (int j = 0; j < gif->width * gif->height; j++) {
uint8_t r = *(color++);
uint8_t g = *(color++);
uint8_t b = *(color++);
uint8_t r = color[0], g = color[1], b = color[2];
if (!gif_is_bgcolor(gif, color))
*(p.argb32++) = 0xFF000000U | (r << 16) | (g << 8) | b;
/* Construct background */
Expand All @@ -593,6 +591,8 @@ static twin_animation_t *_twin_animation_from_gif_file(const char *path)
row++;
col = 0;
}
/* next palette */
color += 3;
}
/* GIF delay in units of 1/100 second */
anim->frame_delays[i] = gif->gce.delay * 10;
Expand Down