Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Unified Diff: source/patched-ffmpeg/libavcodec/vorbisdec.c

Issue 8413019: Fix vorbis decoder bug. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/ffmpeg/
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« README.chromium ('K') | « patches/to_upstream/48_vorbis_residue_buffer.patch ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/patched-ffmpeg/libavcodec/vorbisdec.c
===================================================================
--- source/patched-ffmpeg/libavcodec/vorbisdec.c (revision 107637)
+++ source/patched-ffmpeg/libavcodec/vorbisdec.c (working copy)
@@ -660,7 +660,7 @@
res_setup->partition_size = get_bits(gb, 24) + 1;
/* Validations to prevent a buffer overflow later. */
if (res_setup->begin>res_setup->end ||
- res_setup->end > vc->avccontext->channels * vc->blocksize[1] / 2 ||
+ res_setup->end > (res_setup->type == 2 ? vc->avccontext->channels : 1) * vc->blocksize[1] / 2 ||
rbultje1 2011/10/27 23:36:13 I'm clearly not knowledgeable enough to understand
(res_setup->end-res_setup->begin) / res_setup->partition_size > V_MAX_PARTITIONS) {
av_log(vc->avccontext, AV_LOG_ERROR,
"partition out of bounds: type, begin, end, size, blocksize: %"PRIu16", %"PRIu32", %"PRIu32", %u, %"PRIu32"\n",
@@ -1468,6 +1468,7 @@
uint8_t res_chan[255];
unsigned res_num = 0;
int retlen = 0;
+ int ch_left = vc->audio_channels;
if (get_bits1(gb)) {
av_log(vc->avccontext, AV_LOG_ERROR, "Not a Vorbis I audio packet.\n");
@@ -1542,9 +1543,14 @@
}
}
residue = &vc->residues[mapping->submap_residue[i]];
+ if (ch_left < ch) {
+ av_log(vc->avccontext, AV_LOG_ERROR, "Too many channels in vorbis_floor_decode.\n");
+ return -1;
+ }
vorbis_residue_decode(vc, residue, ch, do_not_decode, ch_res_ptr, blocksize/2);
ch_res_ptr += ch * blocksize / 2;
+ ch_left -= ch;
}
// Inverse coupling
« README.chromium ('K') | « patches/to_upstream/48_vorbis_residue_buffer.patch ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698