summaryrefslogtreecommitdiff
path: root/libavcodec/nuv.c
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2012-07-31 20:47:24 +0200
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2012-08-01 19:35:58 +0200
commit98b0120668a87837475cc9991eb627165bc28508 (patch)
tree876b7a566fc6433107c6ec3f63e79e549826e9c5 /libavcodec/nuv.c
parente1bc0171c0e6ba85cc14a52b979d6cb00b0c38bb (diff)
nuv: Fix playback of RTjpeg from current MythTV,
The previous validity check seems to work only for some (presumably older) files, in current versions the first bytes now contain the data size. Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Diffstat (limited to 'libavcodec/nuv.c')
-rw-r--r--libavcodec/nuv.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libavcodec/nuv.c b/libavcodec/nuv.c
index 17fcb70f99..00860fe120 100644
--- a/libavcodec/nuv.c
+++ b/libavcodec/nuv.c
@@ -191,8 +191,15 @@ retry:
}
if (c->codec_frameheader) {
int w, h, q, res;
- if (buf_size < 12 || buf[0] != 'V') {
- av_log(avctx, AV_LOG_ERROR, "invalid nuv video frame (wrong codec_tag?)\n");
+ if (buf_size < 12) {
+ av_log(avctx, AV_LOG_ERROR, "Too small NUV video frame\n");
+ return AVERROR_INVALIDDATA;
+ }
+ // There seem to exist two variants of this header: one starts with 'V'
+ // and 5 bytes unknown, the other matches current MythTV and is 4 bytes size,
+ // 1 byte header size (== 12), 1 byte version (== 0)
+ if (buf[0] != 'V' && AV_RL16(&buf[4]) != 0x000c) {
+ av_log(avctx, AV_LOG_ERROR, "Unknown secondary frame header (wrong codec_tag?)\n");
return AVERROR_INVALIDDATA;
}
w = AV_RL16(&buf[6]);