git.videolan.org
/
ffmpeg.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
avcodec/nuv: Check for minimum input size for uncomprssed and rtjpeg
[ffmpeg.git]
/
libavcodec
/
nuv.c
diff --git
a/libavcodec/nuv.c
b/libavcodec/nuv.c
index
ad6c029
..
8d806db
100644
(file)
--- a/
libavcodec/nuv.c
+++ b/
libavcodec/nuv.c
@@
-161,6
+161,7
@@
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
int orig_size = buf_size;
int keyframe, ret;
int size_change = 0;
int orig_size = buf_size;
int keyframe, ret;
int size_change = 0;
+ int minsize = 0;
int result, init_frame = !avctx->frame_number;
enum {
NUV_UNCOMPRESSED = '0',
int result, init_frame = !avctx->frame_number;
enum {
NUV_UNCOMPRESSED = '0',
@@
-206,6
+207,16
@@
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
keyframe = 1;
break;
}
keyframe = 1;
break;
}
+ switch (comptype) {
+ case NUV_UNCOMPRESSED:
+ minsize = c->width * c->height * 3 / 2;
+ break;
+ case NUV_RTJPEG:
+ minsize = c->width/16 * (c->height/16) * 6;
+ break;
+ }
+ if (buf_size < minsize / 4)
+ return AVERROR_INVALIDDATA;
retry:
// Skip the rest of the frame header.
buf = &buf[12];
retry:
// Skip the rest of the frame header.
buf = &buf[12];