Previously, we returned 0, meaning successful decoding but 0
bytes consumed, leading to an infinite loop.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: [email protected]
---
Alternatively, we could just return buf_size to signal that the
whole packet was consumed (but nothing was decoded).
---
 libavcodec/pcx.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/pcx.c b/libavcodec/pcx.c
index a6f9d8d..51aea69 100644
--- a/libavcodec/pcx.c
+++ b/libavcodec/pcx.c
@@ -181,6 +181,7 @@ static int pcx_decode_frame(AVCodecContext *avctx, void 
*data, int *got_frame,
         }
         if (*buf++ != 12) {
             av_log(avctx, AV_LOG_ERROR, "expected palette after image data\n");
+            ret = AVERROR_INVALIDDATA;
             goto end;
         }
     } else if (nplanes == 1) {   /* all packed formats, max. 16 colors */
-- 
1.7.9.4

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to