summaryrefslogtreecommitdiff
path: root/libavdevice
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-01-08 08:04:59 +0100
committerAnton Khirnov <anton@khirnov.net>2013-01-13 16:31:17 +0100
commit49dc82eef776634ac2da41fca9f105df25129ad8 (patch)
treec2b9a38738c8bd189163475337f674e76912e051 /libavdevice
parent838b849e70f11dc242399da8d19c5795fe90913b (diff)
v4l2: do not assert on a value received from outside of Libav
Diffstat (limited to 'libavdevice')
-rw-r--r--libavdevice/v4l2.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index eb5de151f3..d57bd755d5 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -460,7 +460,12 @@ static int mmap_read_frame(AVFormatContext *ctx, AVPacket *pkt)
return AVERROR(errno);
}
- assert (buf.index < s->buffers);
+
+ if (buf.index >= s->buffers) {
+ av_log(ctx, AV_LOG_ERROR, "Invalid buffer index received.\n");
+ return AVERROR(EINVAL);
+ }
+
if (s->frame_size > 0 && buf.bytesused != s->frame_size) {
av_log(ctx, AV_LOG_ERROR,
"The v4l2 frame is %d bytes, but %d bytes are expected\n",