diff mbox series

[FFmpeg-devel,2/2] lavc/aac_ac3_parser: Cosmetics

Message ID 1593436991-20076-2-git-send-email-mypopydev@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/2] lavc/aac_ac3_parser: fix the potential overflow
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Jun Zhao June 29, 2020, 1:23 p.m. UTC
From: Jun Zhao <barryjzhao@tencent.com>

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
---
 libavcodec/aac_ac3_parser.c | 31 +++++++++++++++----------------
 1 file changed, 15 insertions(+), 16 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/aac_ac3_parser.c b/libavcodec/aac_ac3_parser.c
index b26790d..23c60f6 100644
--- a/libavcodec/aac_ac3_parser.c
+++ b/libavcodec/aac_ac3_parser.c
@@ -37,37 +37,36 @@  int ff_aac_ac3_parse(AVCodecParserContext *s1,
     int got_frame = 0;
 
 get_next:
-    i=END_NOT_FOUND;
-    if(s->remaining_size <= buf_size){
-        if(s->remaining_size && !s->need_next_header){
-            i= s->remaining_size;
+    i = END_NOT_FOUND;
+    if (s->remaining_size <= buf_size) {
+        if (s->remaining_size && !s->need_next_header) {
+            i = s->remaining_size;
             s->remaining_size = 0;
-        }else{ //we need a header first
-            len=0;
-            for(i=s->remaining_size; i<buf_size; i++){
+        } else { //we need a header first
+            len = 0;
+            for (i=s->remaining_size; i<buf_size; i++) {
                 s->state = (s->state<<8) + buf[i];
-                if((len=s->sync(s->state, s, &s->need_next_header, &new_frame_start)))
+                if ((len=s->sync(s->state, s, &s->need_next_header, &new_frame_start)))
                     break;
             }
-            if(len<=0){
-                i=END_NOT_FOUND;
-            }else{
+            if (len <= 0) {
+                i = END_NOT_FOUND;
+            } else {
                 got_frame = 1;
-                s->state=0;
+                s->state = 0;
                 i-= s->header_size -1;
                 s->remaining_size = len;
-                if(!new_frame_start || pc->index+i<=0){
+                if (!new_frame_start || pc->index+i <= 0) {
                     s->remaining_size += i;
                     goto get_next;
-                }
-                else if (i < 0) {
+                } else if (i < 0) {
                     s->remaining_size += i;
                 }
             }
         }
     }
 
-    if(ff_combine_frame(pc, i, &buf, &buf_size)<0){
+    if (ff_combine_frame(pc, i, &buf, &buf_size) < 0) {
         s->remaining_size -= FFMIN(s->remaining_size, buf_size);
         *poutbuf = NULL;
         *poutbuf_size = 0;