Changeset fd9d431500c57afe9d014e5d30d54b9378afc484

Show
Ignore:
Timestamp:
03/11/08 02:57:18 (2 months ago)
Author:
Jean-Baptiste Kempf <jb@videolan.org>
git-committer:
Jean-Baptiste Kempf <jb@videolan.org> 1205200638 -0700
git-parent:

[1703d8421a3b582da45c837f42e04d1ea0e8d609]

git-author:
Jean-Baptiste Kempf <jb@videolan.org> 1205200638 -0700
Message:

Additional checks on malloc output in data reader.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/demux/real.c

    r1703d84 rfd9d431  
    150150    p_demux->pf_demux = Demux; 
    151151    p_demux->pf_control = Control; 
     152 
    152153    p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) ); 
     154    if( p_sys == NULL ) 
     155    { 
     156        return VLC_ENOMEM; 
     157    } 
    153158    memset( p_sys, 0, sizeof( demux_sys_t ) ); 
     159 
    154160    p_sys->i_data_offset = 0; 
    155161    p_sys->i_track = 0; 
     
    11741180        case VLC_FOURCC( 'r','a','a','c' ): 
    11751181        case VLC_FOURCC( 'r','a','c','p' ): 
     1182            fmt.i_codec = VLC_FOURCC( 'm','p','4','a' ); 
     1183 
    11761184            if( fmt.i_extra > 0 ) { fmt.i_extra--; p_peek++; } 
    11771185            if( fmt.i_extra > 0 ) 
    11781186            { 
    11791187                fmt.p_extra = malloc( fmt.i_extra ); 
     1188                if( fmt.p_extra == NULL ) 
     1189                { 
     1190                    msg_Err( p_demux, "Error in the extra data" ); 
     1191                    return VLC_EGENERIC; 
     1192                } 
    11801193                memcpy( fmt.p_extra, p_peek, fmt.i_extra ); 
    11811194            } 
    1182  
    1183             fmt.i_codec = VLC_FOURCC( 'm','p','4','a' ); 
    11841195            break; 
    11851196 
     
    11921203            else 
    11931204                fmt.audio.i_blockalign = i_coded_frame_size; 
    1194             if( !fmt.i_extra ) break; 
    1195             fmt.p_extra = malloc( fmt.i_extra ); 
    1196             memcpy( fmt.p_extra, p_peek, fmt.i_extra ); 
     1205 
     1206            if( fmt.i_extra > 0 ) 
     1207            { 
     1208                fmt.p_extra = malloc( fmt.i_extra ); 
     1209                if( fmt.p_extra == NULL ) 
     1210                { 
     1211                    msg_Err( p_demux, "Error in the extra data" ); 
     1212                    return VLC_EGENERIC; 
     1213                } 
     1214                memcpy( fmt.p_extra, p_peek, fmt.i_extra ); 
     1215            } 
    11971216            break; 
    11981217