[02/18] svq3: Check for any negative return value from ff_h264_check_intra_pred_mode

Message ID 1379358389-64839-2-git-send-email-martin@martin.st
State Committed
Headers show

Commit Message

Martin Storsjö Sept. 16, 2013, 7:06 p.m.
Also pass on any returned error code.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
---
 libavcodec/svq3.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Diego Biurrun Sept. 16, 2013, 9:18 p.m. | #1
On Mon, Sep 16, 2013 at 10:06:13PM +0300, Martin Storsjö wrote:
> --- a/libavcodec/svq3.c
> +++ b/libavcodec/svq3.c
> @@ -652,9 +652,9 @@ static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
>  
> -        if ((h->intra16x16_pred_mode = ff_h264_check_intra_pred_mode(h, dir, 0)) == -1) {
> -            av_log(h->avctx, AV_LOG_ERROR, "check_intra_pred_mode = -1\n");
> -            return -1;
> +        if ((h->intra16x16_pred_mode = ff_h264_check_intra_pred_mode(h, dir, 0)) < 0) {
> +            av_log(h->avctx, AV_LOG_ERROR, "check_intra_pred_mode < 0\n");
> +            return h->intra16x16_pred_mode;

LGTM, but maybe adjust the name of the function in the av_log() call.

Diego

Patch

diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index f99a83f..da22c49 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -652,9 +652,9 @@  static int svq3_decode_mb(SVQ3Context *s, unsigned int mb_type)
         dir = i_mb_type_info[mb_type - 8].pred_mode;
         dir = (dir >> 1) ^ 3 * (dir & 1) ^ 1;
 
-        if ((h->intra16x16_pred_mode = ff_h264_check_intra_pred_mode(h, dir, 0)) == -1) {
-            av_log(h->avctx, AV_LOG_ERROR, "check_intra_pred_mode = -1\n");
-            return -1;
+        if ((h->intra16x16_pred_mode = ff_h264_check_intra_pred_mode(h, dir, 0)) < 0) {
+            av_log(h->avctx, AV_LOG_ERROR, "check_intra_pred_mode < 0\n");
+            return h->intra16x16_pred_mode;
         }
 
         cbp     = i_mb_type_info[mb_type - 8].cbp;