summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/util/avhuff.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/util/avhuff.c b/src/lib/util/avhuff.c
index 448a33e23fc..de8353abfb3 100644
--- a/src/lib/util/avhuff.c
+++ b/src/lib/util/avhuff.c
@@ -675,7 +675,9 @@ avhuff_error avhuff_decoder::decode_data(const UINT8 *source, UINT32 complength,
if (complength < 10 + 2 * channels)
return AVHERR_INVALID_DATA;
UINT32 totalsize = 10 + 2 * channels;
- totalsize += (source[8] << 8) | source[9];
+ UINT32 treesize = (source[8] << 8) | source[9];
+ if (treesize != 0xffff)
+ totalsize += treesize;
for (int chnum = 0; chnum < channels; chnum++)
totalsize += (source[10 + 2 * chnum] << 8) | source[11 + 2 * chnum];
if (totalsize >= complength)