History

avcodec/vvc_mp4toannexb: more validations for nalu_len

For a corrupted stream, the value of nalu_len read from the extradata is not reliable. We need to perform additional checks Fixes: fuzzer timeout Fixes: 65253/clusterfuzz-testcase-minimized-ffmpeg_BSF_VVC_MP4TOANNEXB_fuzzer-4972412487467008

Nuo Mi committed 2 years ago

Commit f7a504a1 parent 78949041 file · +4 −3Browse files

Unified · Split

libavcodec/bsf/vvc_mp4toannexb.c+4−3
@@ -155,10 +155,11 @@ static int vvc_extradata_to_annexb(AVBSFContext *ctx) · 154 unmodified lines
155155 }
156156
157157 for (j = 0; j < cnt; j++) {
158− int nalu_len = bytestream2_get_be16(&gb);
158+ const int nalu_len = bytestream2_get_be16(&gb);
159159
160− if (4 + AV_INPUT_BUFFER_PADDING_SIZE + nalu_len >
161− SIZE_MAX - new_extradata_size) {
160+ if (!nalu_len ||
161+ nalu_len > bytestream2_get_bytes_left(&gb) ||
162+ 4 + AV_INPUT_BUFFER_PADDING_SIZE + nalu_len > SIZE_MAX - new_extradata_size) {
162163 ret = AVERROR_INVALIDDATA;
163164 goto fail;
164165 }

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