From d42fd744e68a84c5a11803e36f2274a06c6927b6 Mon Sep 17 00:00:00 2001 From: Nils Wallménius Date: Tue, 3 Aug 2010 09:48:57 +0000 Subject: 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 --- apps/codecs/flac.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/codecs/flac.c b/apps/codecs/flac.c index c23611a50b..64d380d2a2 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) -- cgit v1.2.3