Skip to content

[Coverity 1666303] Dereference after null check in stats.c

Either the check against null is unnecessary, or there may be a null pointer dereference.

In DecodeBlock: Pointer is checked against null but then dereferenced anyway (CWE-476)

 50    if( !decoder_UpdateVideoFormat( p_dec ) )
 51        p_pic = decoder_NewPicture( p_dec );
      3. Condition !p_pic, taking true branch.
      4. var_compare_op: Comparing p_pic to null implies that p_pic might be null.
 52    if( !p_pic )
      5. Jumping to label error.
 53        goto error;
 54
 55    vlc_tick_t tick;
 56    if( p_block->i_buffer == kBufferSize )
 57    {
 58        memcpy(&tick, p_block->p_buffer, sizeof(vlc_tick_t));
 59        msg_Dbg( p_dec, "got %"PRIu64" ms",
 60                 MS_FROM_VLC_TICK(tick) );
 61        msg_Dbg( p_dec, "got %"PRIu64" ms offset",
 62                 MS_FROM_VLC_TICK(vlc_tick_now() - tick) );
 63    }
 64    else
 65    {
 66        msg_Dbg( p_dec, "got a packet not from stats demuxer" );
 67        tick = vlc_tick_now();
 68    }
 69    memcpy(p_pic->p->p_pixels, &tick, sizeof(vlc_tick_t));
 70
 71    p_pic->date = p_block->i_pts != VLC_TICK_INVALID ?
 72            p_block->i_pts : p_block->i_dts;
 73
 74error:
 75    block_Release( p_block );
     
CID 1666303: (#1 of 1): Dereference after null check (FORWARD_NULL)
6. var_deref_model: Passing null pointer p_pic to decoder_QueueVideo, which dereferences it.[show details]
 76    decoder_QueueVideo( p_dec, p_pic );
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information