History

avcodec/libvorbisdec: Fix insufficient input checks leading to out of array reads

Fixes: 16144/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LIBVORBIS_fuzzer-5638618940440576 Fixes: out of array read

Michael Niedermayer committed 7 years ago

Commit 069be4a1 parent 1850c3f1 file · +7 −4Browse files

Unified · Split

libavcodec/libvorbisdec.c+7−4
@@ -64,22 +64,25 @@ static int oggvorbis_decode_init(AVCodecContext *avccontext) { · 63 unmodified lines
64 }64 }
65 } else if(*p == 2) {65 } else if(*p == 2) {
66 unsigned int offset = 1;66 unsigned int offset = 1;
67 unsigned int sizesum = 1;
67 p++;68 p++;
68 for(i=0; i<2; i++) {69 for(i=0; i<2; i++) {
69 hsizes[i] = 0;70 hsizes[i] = 0;
70 while((*p == 0xFF) && (offset < avccontext->extradata_size)) {71 while((*p == 0xFF) && (sizesum < avccontext->extradata_size)) {
71 hsizes[i] += 0xFF;72 hsizes[i] += 0xFF;
72 offset++;73 offset++;
74 sizesum += 1 + 0xFF;
73 p++;75 p++;
74 }76 }
75 if(offset >= avccontext->extradata_size - 1) {77 hsizes[i] += *p;
78 offset++;
79 sizesum += 1 + *p;
80 if(sizesum > avccontext->extradata_size) {
76 av_log(avccontext, AV_LOG_ERROR,81 av_log(avccontext, AV_LOG_ERROR,
77 "vorbis header sizes damaged\n");82 "vorbis header sizes damaged\n");
78 ret = AVERROR_INVALIDDATA;83 ret = AVERROR_INVALIDDATA;
79 goto error;84 goto error;
80 }85 }
81 hsizes[i] += *p;
82 offset++;
83 p++;86 p++;
84 }87 }
85 hsizes[2] = avccontext->extradata_size - hsizes[0]-hsizes[1]-offset;88 hsizes[2] = avccontext->extradata_size - hsizes[0]-hsizes[1]-offset;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t