Browse Source

flacdec: fix buffer size checking in get_metadata_size()

Adds an additional check before reading the next block header and avoids a
potential integer overflow when checking the metadata size against the
remaining buffer size.
(cherry picked from commit 4c5e7b27d5)
tags/n0.8.5
Justin Ruggles Michael Niedermayer 14 years ago
parent
commit
20047f77b9
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      libavcodec/flacdec.c

+ 3
- 1
libavcodec/flacdec.c View File

@@ -228,9 +228,11 @@ static int get_metadata_size(const uint8_t *buf, int buf_size)

buf += 4;
do {
if (buf_end - buf < 4)
return 0;
ff_flac_parse_block_header(buf, &metadata_last, NULL, &metadata_size);
buf += 4;
if (buf + metadata_size > buf_end) {
if (buf_end - buf < metadata_size) {
/* need more data in order to read the complete header */
return 0;
}


Loading…
Cancel
Save