diff mbox

[FFmpeg-devel] lavc/svq3: Fail for media key encryption

Message ID 201701231349.23455.cehoyos@ag.or.at
State Accepted
Commit 6d6faa2a2ded9cc203a9f2d8dcceebbda27a12a4
Headers show

Commit Message

Carl Eugen Hoyos Jan. 23, 2017, 12:49 p.m. UTC
Hi!

Attached patch responds to ticket #6094, pure guessing.

Please comment, Carl Eugen
From 4d9ca2ef2c455381509a1538676f9aea91de95a2 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <cehoyos@ag.or.at>
Date: Mon, 23 Jan 2017 13:39:56 +0100
Subject: [PATCH] lavc/svq3: Fail for media key encryption.

Fixes a part of ticket #6094.
---
 libavcodec/svq3.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Carl Eugen Hoyos Jan. 24, 2017, 10:42 p.m. UTC | #1
2017-01-23 13:49 GMT+01:00 Carl Eugen Hoyos <cehoyos@ag.or.at>:

> Attached patch responds to ticket #6094, pure guessing.

Pushed after tests by Piotr.

Carl Eugen
diff mbox

Patch

diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index e0747d5..5b99656 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -1070,14 +1070,16 @@  static int svq3_decode_slice_header(AVCodecContext *avctx)
         av_log(s->avctx, AV_LOG_ERROR, "illegal slice type %u \n", slice_id);
         return -1;
     }
+    if (get_bits1(&s->gb_slice)) {
+        avpriv_report_missing_feature(s->avctx, "Media key encryption");
+        return AVERROR_PATCHWELCOME;
+    }
 
     s->slice_type = ff_h264_golomb_to_pict_type[slice_id];
 
     if ((header & 0x9F) == 2) {
-        i = (s->mb_num < 64) ? 6 : (1 + av_log2(s->mb_num - 1));
+        i = (s->mb_num < 64) ? 5 : av_log2(s->mb_num - 1);
         get_bits(&s->gb_slice, i);
-    } else {
-        skip_bits1(&s->gb_slice);
     }
 
     s->slice_num      = get_bits(&s->gb_slice, 8);