[vlc-devel] [vlc-commits] demux: mkv: read dimensions as stored size (fix #25012)

Steve Lhomme robux4 at ycbcr.xyz
Wed Aug 12 06:03:21 CEST 2020


It can probably work without a cast at all. The EbmlUInteger class can 
cast to uint8, uint16, uint32 and uint64.

Since some of them are internal fields it's probably better to change 
these to the safer type. The actual storage is uint64_t.

Can you submit patches to the mailing list for code you don't maintain ?

On 2020-08-11 13:28, Francois Cartegnie wrote:
> vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Aug 11 13:23:10 2020 +0200| [0d02c4aa6c2286116174c3d2a575a6fe0c6d7942] | committer: Francois Cartegnie
> 
> demux: mkv: read dimensions as stored size (fix #25012)
> 
>> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0d02c4aa6c2286116174c3d2a575a6fe0c6d7942
> ---
> 
>   modules/demux/mkv/matroska_segment_parse.cpp | 32 ++++++++++++++--------------
>   1 file changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp
> index 70b2d7bc10..49e1d3f260 100644
> --- a/modules/demux/mkv/matroska_segment_parse.cpp
> +++ b/modules/demux/mkv/matroska_segment_parse.cpp
> @@ -622,50 +622,50 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
>           E_CASE( KaxVideoPixelWidth, vwidth )
>           {
>               ONLY_FMT(VIDEO);
> -            vars.tk->fmt.video.i_width += static_cast<uint16>( vwidth );
> -            debug( vars, "width=%d", vars.tk->fmt.video.i_width );
> +            vars.tk->fmt.video.i_width += static_cast<uint32>( vwidth );
> +            debug( vars, "width=%u", vars.tk->fmt.video.i_width );
>           }
>           E_CASE( KaxVideoPixelHeight, vheight )
>           {
>               ONLY_FMT(VIDEO);
> -            vars.tk->fmt.video.i_height += static_cast<uint16>( vheight );
> -            debug( vars, "height=%d", vars.tk->fmt.video.i_height );
> +            vars.tk->fmt.video.i_height += static_cast<uint32>( vheight );
> +            debug( vars, "height=%u", vars.tk->fmt.video.i_height );
>           }
>           E_CASE( KaxVideoDisplayWidth, vwidth )
>           {
>               ONLY_FMT(VIDEO);
> -            vars.track_video_info.i_display_width = static_cast<uint16>( vwidth );
> -            debug( vars, "display width=%d", vars.track_video_info.i_display_width );
> +            vars.track_video_info.i_display_width = static_cast<uint32>( vwidth );
> +            debug( vars, "display width=%u", vars.track_video_info.i_display_width );
>           }
>           E_CASE( KaxVideoDisplayHeight, vheight )
>           {
>               ONLY_FMT(VIDEO);
> -            vars.track_video_info.i_display_height = static_cast<uint16>( vheight );
> -            debug( vars, "display height=%d", vars.track_video_info.i_display_height );
> +            vars.track_video_info.i_display_height = static_cast<uint32>( vheight );
> +            debug( vars, "display height=%u", vars.track_video_info.i_display_height );
>           }
>           E_CASE( KaxVideoPixelCropBottom, cropval )
>           {
>               ONLY_FMT(VIDEO);
> -            vars.track_video_info.i_crop_bottom = static_cast<uint16>( cropval );
> -            debug( vars, "crop pixel bottom=%d", vars.track_video_info.i_crop_bottom );
> +            vars.track_video_info.i_crop_bottom = static_cast<uint32>( cropval );
> +            debug( vars, "crop pixel bottom=%u", vars.track_video_info.i_crop_bottom );
>           }
>           E_CASE( KaxVideoPixelCropTop, cropval )
>           {
>               ONLY_FMT(VIDEO);
> -            vars.track_video_info.i_crop_top = static_cast<uint16>( cropval );
> -            debug( vars, "crop pixel top=%d", vars.track_video_info.i_crop_top );
> +            vars.track_video_info.i_crop_top = static_cast<uint32>( cropval );
> +            debug( vars, "crop pixel top=%u", vars.track_video_info.i_crop_top );
>           }
>           E_CASE( KaxVideoPixelCropRight, cropval )
>           {
>               ONLY_FMT(VIDEO);
> -            vars.track_video_info.i_crop_right = static_cast<uint16>( cropval );
> -            debug( vars, "crop pixel right=%d", vars.track_video_info.i_crop_right );
> +            vars.track_video_info.i_crop_right = static_cast<uint32>( cropval );
> +            debug( vars, "crop pixel right=%u", vars.track_video_info.i_crop_right );
>           }
>           E_CASE( KaxVideoPixelCropLeft, cropval )
>           {
>               ONLY_FMT(VIDEO);
> -            vars.track_video_info.i_crop_left = static_cast<uint16>( cropval );
> -            debug( vars, "crop pixel left=%d", vars.track_video_info.i_crop_left );
> +            vars.track_video_info.i_crop_left = static_cast<uint32>( cropval );
> +            debug( vars, "crop pixel left=%u", vars.track_video_info.i_crop_left );
>           }
>           E_CASE( KaxVideoDisplayUnit, vdmode )
>           {
> 
> _______________________________________________
> vlc-commits mailing list
> vlc-commits at videolan.org
> https://mailman.videolan.org/listinfo/vlc-commits
> 


More information about the vlc-devel mailing list