diff options
| author | Nils Wallménius <nils@rockbox.org> | 2010-08-03 09:48:57 +0000 |
|---|---|---|
| committer | Nils Wallménius <nils@rockbox.org> | 2010-08-03 09:48:57 +0000 |
| commit | d42fd744e68a84c5a11803e36f2274a06c6927b6 (patch) | |
| tree | f73b05a214d0fa46d320dc431c879ee16f136e57 | |
| parent | a83adc7d6d0a16d08687a903da8a992e3affedcc (diff) | |
| download | rockbox-d42fd744e68a84c5a11803e36f2274a06c6927b6.zip rockbox-d42fd744e68a84c5a11803e36f2274a06c6927b6.tar.gz rockbox-d42fd744e68a84c5a11803e36f2274a06c6927b6.tar.bz2 rockbox-d42fd744e68a84c5a11803e36f2274a06c6927b6.tar.xz | |
flac: error out if max blocksize is larger than we can handle.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27676 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | apps/codecs/flac.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/apps/codecs/flac.c b/apps/codecs/flac.c index c23611a..64d380d 100644 --- a/apps/codecs/flac.c +++ b/apps/codecs/flac.c @@ -118,7 +118,13 @@ static bool flac_init(FLACContext* fc, int first_frame_offset) fc->filesize = ci->filesize; fc->min_blocksize = (buf[0] << 8) | buf[1]; - fc->max_blocksize = (buf[2] << 8) | buf[3]; + int max_blocksize = (buf[2] << 8) | buf[3]; + if (max_blocksize > MAX_BLOCKSIZE) + { + LOGF("FLAC: Maximum blocksize is too large\n"); + return false; + } + fc->max_blocksize = max_blocksize; fc->min_framesize = (buf[4] << 16) | (buf[5] << 8) | buf[6]; fc->max_framesize = (buf[7] << 16) | (buf[8] << 8) | buf[9]; fc->samplerate = (buf[10] << 12) | (buf[11] << 4) |