diff options
author | James Almer <jamrial@gmail.com> | 2017-11-24 19:42:50 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2017-11-30 00:17:41 -0300 |
commit | ae7df68edd79bce5c318810c6b307ee4e81cd2a6 (patch) | |
tree | b76971cbfb256025a871da1130d17af24b7c7b03 /libavformat/avc.c | |
parent | 8c2b37e678e3d5ab16fef471fffc741b88622a85 (diff) | |
download | ffmpeg-ae7df68edd79bce5c318810c6b307ee4e81cd2a6.tar.gz |
avformat/avc: return an error in ff_isom_write_avcc if the buffer lenght is too small
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/avc.c')
-rw-r--r-- | libavformat/avc.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libavformat/avc.c b/libavformat/avc.c index 094a95821f..5232ed55f8 100644 --- a/libavformat/avc.c +++ b/libavformat/avc.c @@ -105,7 +105,9 @@ int ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size) int ff_isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len) { - if (len > 6) { + if (len <= 6) + return AVERROR_INVALIDDATA; + /* check for H.264 start code */ if (AV_RB32(data) == 0x00000001 || AV_RB24(data) == 0x000001) { @@ -157,7 +159,6 @@ int ff_isom_write_avcc(AVIOContext *pb, const uint8_t *data, int len) } else { avio_write(pb, data, len); } - } return 0; } |