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
155 }155 }
156 156
157 for (j = 0; j < cnt; j++) {157 for (j = 0; j < cnt; j++) {
158 int nalu_len = bytestream2_get_be16(&gb);158 const int nalu_len = bytestream2_get_be16(&gb);
159 159
160 if (4 + AV_INPUT_BUFFER_PADDING_SIZE + nalu_len >160 if (!nalu_len ||
161 SIZE_MAX - new_extradata_size) {161 nalu_len > bytestream2_get_bytes_left(&gb) ||
162 4 + AV_INPUT_BUFFER_PADDING_SIZE + nalu_len > SIZE_MAX - new_extradata_size) {
162 ret = AVERROR_INVALIDDATA;163 ret = AVERROR_INVALIDDATA;
163 goto fail;164 goto fail;
164 }165 }

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