You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.6 KiB
46 lines
1.6 KiB
From e05fb81a20541833a2d62ce08552b18c0920b9a1 Mon Sep 17 00:00:00 2001
|
|
From: Cosmin Truta <ctruta@gmail.com>
|
|
Date: Sat, 25 Nov 2017 23:17:46 -0500
|
|
Subject: [PATCH] gifread: Detect indirect circular dependencies in LZW tables
|
|
|
|
---
|
|
src/gifread/gifread.c | 4 +++-
|
|
src/gifread/gifread.h | 2 +-
|
|
2 files changed, 4 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/gifread/gifread.c b/src/gifread/gifread.c
|
|
index 0123456789abcdef..0123456789abcdef 100644
|
|
--- a/src/gifread/gifread.c
|
|
+++ b/src/gifread/gifread.c
|
|
@@ -5,7 +5,7 @@
|
|
* @author Cosmin Truta
|
|
*
|
|
* @section Copyright
|
|
- * Copyright (C) 2003-2015 Cosmin Truta.
|
|
+ * Copyright (C) 2003-2017 Cosmin Truta.
|
|
* This software was derived from "giftopnm.c" by David Koblas,
|
|
* and is distributed under the same copyright and warranty terms.
|
|
*
|
|
@@ -499,6 +499,8 @@ static int LZWReadByte(int init_flag, int input_code_size, FILE *stream)
|
|
*sp++ = table[1][code];
|
|
if (code == table[0][code])
|
|
GIFError("GIF/LZW error: circular table entry");
|
|
+ if ((size_t)(sp - stack) >= sizeof(stack) / sizeof(stack[0]))
|
|
+ GIFError("GIF/LZW error: circular table");
|
|
code = table[0][code];
|
|
}
|
|
|
|
diff --git a/src/gifread/gifread.h b/src/gifread/gifread.h
|
|
index 0123456789abcdef..0123456789abcdef 100644
|
|
--- a/src/gifread/gifread.h
|
|
+++ b/src/gifread/gifread.h
|
|
@@ -5,7 +5,7 @@
|
|
* @author Cosmin Truta
|
|
*
|
|
* @section Copyright
|
|
- * Copyright (C) 2003-2015 Cosmin Truta.
|
|
+ * Copyright (C) 2003-2017 Cosmin Truta.
|
|
* This software was derived from "giftopnm.c" by David Koblas,
|
|
* and is distributed under the same copyright and warranty terms.
|
|
*
|