[FFmpeg-devel,02/11] avcodec/aacdec_template: Check decode_extension_payload() for failure

Submitted by Michael Niedermayer on Sept. 27, 2019, 5:23 p.m.

Details

Message ID 20190927172350.2095-2-michael@niedermayer.cc
State Accepted
Commit ca3d8b471f1b8c7950bd7819757391945a3f4483
Headers show

Commit Message

Michael Niedermayer Sept. 27, 2019, 5:23 p.m.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/aacdec_template.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
index 6e086e00df..f1e03d3d77 100644
--- a/libavcodec/aacdec_template.c
+++ b/libavcodec/aacdec_template.c
@@ -3246,9 +3246,15 @@  static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
                     err = AVERROR_INVALIDDATA;
                     goto fail;
             }
-            while (elem_id > 0)
-                elem_id -= decode_extension_payload(ac, gb, elem_id, che_prev, che_prev_type);
-            err = 0; /* FIXME */
+            err = 0;
+            while (elem_id > 0) {
+                int ret = decode_extension_payload(ac, gb, elem_id, che_prev, che_prev_type);
+                if (ret < 0) {
+                    err = ret;
+                    break;
+                }
+                elem_id -= ret;
+            }
             break;
 
         default: