indeo2: fail if input buffer too small
(cherry picked from commit b7ce4f1d1c)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
			
			
This commit is contained in:
		
				
					committed by
					
						
						Michael Niedermayer
					
				
			
			
				
	
			
			
			
						parent
						
							70f01f1262
						
					
				
				
					commit
					457f869b73
				
			@@ -153,6 +153,13 @@ static int ir2_decode_frame(AVCodecContext *avctx,
 | 
				
			|||||||
        return -1;
 | 
					        return -1;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    start = 48; /* hardcoded for now */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (start >= buf_size) {
 | 
				
			||||||
 | 
					        av_log(s->avctx, AV_LOG_ERROR, "input buffer size too small (%d)\n", buf_size);
 | 
				
			||||||
 | 
					        return AVERROR_INVALIDDATA;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    s->decode_delta = buf[18];
 | 
					    s->decode_delta = buf[18];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* decide whether frame uses deltas or not */
 | 
					    /* decide whether frame uses deltas or not */
 | 
				
			||||||
@@ -160,7 +167,6 @@ static int ir2_decode_frame(AVCodecContext *avctx,
 | 
				
			|||||||
    for (i = 0; i < buf_size; i++)
 | 
					    for (i = 0; i < buf_size; i++)
 | 
				
			||||||
        buf[i] = ff_reverse[buf[i]];
 | 
					        buf[i] = ff_reverse[buf[i]];
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
    start = 48; /* hardcoded for now */
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    init_get_bits(&s->gb, buf + start, (buf_size - start) * 8);
 | 
					    init_get_bits(&s->gb, buf + start, (buf_size - start) * 8);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user