[Ffmpeg-devel] Possible use of uninitialized variable

Panagiotis Issaris takis.issaris
Wed Jan 24 17:12:41 CET 2007


Hi,

GCC complains that the "line" variable defined on line 3550 snow.c
could be used without having been initialized.

At first sight this appears to be the case, when start_y == 0. Line will
not be assigned on line 3554 but its uninitialized value will be
assigned to prev, which gets dereferenced in each of the possible
outcomes of the if's which follow (if end_y>1). Is end_y always <=1 if
start_y == 0?


>     3544 static void correlate_slice_buffered(SnowContext *s, slice_buffer * sb, SubBand *b, DWTELEM *src, int stride, int inverse, int use_median, int start         _y, int end_y){
>     3545     const int w= b->width;
>     3546     int x,y;
>     3547 
>     3548 //    START_TIMER
>     3549 
>     3550     DWTELEM * line;
>     3551     DWTELEM * prev;
>     3552 
>     3553     if (start_y != 0)
>     3554         line = slice_buffer_get_line(sb, ((start_y - 1) * b->stride_line) + b->buf_y_offset) + b->buf_x_offset;
>     3555 
>     3556     for(y=start_y; y<end_y; y++){
>     3557         prev = line;
>     3558 //        line = slice_buffer_get_line_from_address(sb, src + (y * stride));
>     3559         line = slice_buffer_get_line(sb, (y * b->stride_line) + b->buf_y_offset) + b->buf_x_offset;
>     3560         for(x=0; x<w; x++){
>     3561             if(x){
>     3562                 if(use_median){
>     3563                     if(y && x+1<w) line[x] += mid_pred(line[x - 1], prev[x], prev[x + 1]);
>     3564                     else  line[x] += line[x - 1];
>     3565                 }else{
>     3566                     if(y) line[x] += mid_pred(line[x - 1], prev[x], line[x - 1] + prev[x] - prev[x - 1]);
>     3567                     else  line[x] += line[x - 1];
>     3568                 }
>     3569             }else{
>     3570                 if(y) line[x] += prev[x];
>     3571             }
>     3572         }
>     3573     }  
   

With friendly regards,
Takis
-- 
vCard: http://www.issaris.org/pi.vcf
Public key: http://www.issaris.org/pi.key
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070124/fc6b9f87/attachment.pgp>



More information about the ffmpeg-devel mailing list