From: Michael Niedermayer <[email protected]>

Signed-off-by: Michael Niedermayer <[email protected]>
---
 libavcodec/jpeg2kdec.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/libavcodec/jpeg2kdec.c b/libavcodec/jpeg2kdec.c
index bf1fd10..a80110d 100644
--- a/libavcodec/jpeg2kdec.c
+++ b/libavcodec/jpeg2kdec.c
@@ -330,7 +330,7 @@ static int get_cod(Jpeg2KDecoderContext *s, 
Jpeg2KCodingStyle *c,
                    uint8_t *properties)
 {
     Jpeg2KCodingStyle tmp;
-    int compno;
+    int compno, ret;
 
     if (bytestream2_get_bytes_left(&s->g) < 5)
         return AVERROR_INVALIDDATA;
@@ -343,7 +343,9 @@ static int get_cod(Jpeg2KDecoderContext *s, 
Jpeg2KCodingStyle *c,
     tmp.nlayers    = bytestream2_get_be16u(&s->g);
     tmp.mct        = bytestream2_get_byteu(&s->g); // multiple component 
transformation
 
-    get_cox(s, &tmp);
+    if ((ret = get_cox(s, &tmp)) < 0)
+        return ret;
+
     for (compno = 0; compno < s->ncomponents; compno++)
         if (!(properties[compno] & HAD_COC))
             memcpy(c + compno, &tmp, sizeof(tmp));
@@ -355,7 +357,7 @@ static int get_cod(Jpeg2KDecoderContext *s, 
Jpeg2KCodingStyle *c,
 static int get_coc(Jpeg2KDecoderContext *s, Jpeg2KCodingStyle *c,
                    uint8_t *properties)
 {
-    int compno;
+    int compno, ret;
 
     if (bytestream2_get_bytes_left(&s->g) < 2)
         return AVERROR_INVALIDDATA;
@@ -371,7 +373,9 @@ static int get_coc(Jpeg2KDecoderContext *s, 
Jpeg2KCodingStyle *c,
 
     c      += compno;
     c->csty = bytestream2_get_byteu(&s->g);
-    get_cox(s, c);
+
+    if ((ret = get_cox(s, c)) < 0)
+        return ret;
 
     properties[compno] |= HAD_COC;
     return 0;
-- 
1.7.9.5

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

Reply via email to