summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2017-01-27 14:06:58 +0000
committerVincent Sanders <vince@kyllikki.org>2017-01-27 14:06:58 +0000
commitf4ccd56c717d4ee3f2f2a0791b5f8134d8a1645e (patch)
tree70c00eeb25d62d8c5e322afecac25213a3a09e5b /src
parenta1617883903bf102af5d6712c9812261efe1ccb9 (diff)
downloadlibnsgif-f4ccd56c717d4ee3f2f2a0791b5f8134d8a1645e.tar.gz
libnsgif-f4ccd56c717d4ee3f2f2a0791b5f8134d8a1645e.tar.bz2
fix the colour table size check to be correct
Diffstat (limited to 'src')
-rw-r--r--src/libnsgif.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libnsgif.c b/src/libnsgif.c
index 8422563..9f9bd8d 100644
--- a/src/libnsgif.c
+++ b/src/libnsgif.c
@@ -62,6 +62,8 @@
#define GIF_BLOCK_TERMINATOR 0x00
#define GIF_TRAILER 0x3b
+#define GIF_STANDARD_HEADER_SIZE 13
+
/* Internal GIF routines */
static gif_result gif_initialise_sprite(gif_animation *gif, unsigned int width, unsigned int height);
static gif_result gif_initialise_frame(gif_animation *gif);
@@ -1310,7 +1312,7 @@ gif_result gif_initialise(gif_animation *gif, size_t size, unsigned char *data)
if (gif->global_colour_table[0] == GIF_PROCESS_COLOURS) {
/* Check for a global colour map signified by bit 7 */
if (gif->global_colours) {
- if (gif->buffer_size < (gif->colour_table_size * 3 + 12)) {
+ if (gif->buffer_size < (gif->colour_table_size * 3 + GIF_STANDARD_HEADER_SIZE)) {
return GIF_INSUFFICIENT_DATA;
}
for (index = 0; index < gif->colour_table_size; index++) {