aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Strasser <eclipse7@gmx.net>2011-09-24 18:00:16 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-10-01 20:29:07 +0200
commit7aa24b157dedf39dadade9b0d59071574f6580da (patch)
treeaf0d9818ff7083bc4303ebbf6e05d1749029475a
parent02affe2f0e8603533a80be9a1864cce0039e9c63 (diff)
downloadffmpeg-7aa24b157dedf39dadade9b0d59071574f6580da.tar.gz
h264: ff_h264_decode_extradata: check buffer args
The buffer size and pointer were not checked prior to testing the first byte of the buffer. These were sometimes checked before calling, but it is better to add it inside the function as it takes buf and size arguments. Signed-off-by: Alexander Strasser <eclipse7@gmx.net> (cherry picked from commit 715f259bf949b06df1b5ed0307606dc258754c99)
-rw-r--r--libavcodec/h264.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 4a2b0f0a92..9c7bf24b5f 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1022,6 +1022,9 @@ int ff_h264_decode_extradata(H264Context *h, const uint8_t *buf, int size)
{
AVCodecContext *avctx = h->s.avctx;
+ if(!buf || size <= 0)
+ return -1;
+
if(buf[0] == 1){
int i, cnt, nalsize;
const unsigned char *p = buf;