Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
69610064 by Steve Lhomme at 2026-01-13T08:23:20+00:00
decoder_helper: add the decoder padding values in one call
No loop and the modulo is only called once.
- - - - -
a7a813bc by Steve Lhomme at 2026-01-13T08:23:20+00:00
decoder_helpers: error out on decoder dimensions too large
We cannot adjust the decoding dimensions to the alignment necessary
if the source video is too large.
Fixes #29532
- - - - -
746f0da3 by Steve Lhomme at 2026-01-13T08:23:20+00:00
decoder_helpers: also check adding the offset to visible dimensions is legit
- - - - -
1 changed file:
- src/input/decoder_helpers.c
Changes:
=====================================
src/input/decoder_helpers.c
=====================================
@@ -34,6 +34,8 @@
#include <vlc_picture.h>
#include "../libvlc.h"
+#include <stdckdint.h>
+
void decoder_Init( decoder_t *p_dec, es_format_t *restrict fmt_in, const
es_format_t *restrict p_fmt )
{
p_dec->i_extra_picture_buffers = 0;
@@ -154,14 +156,37 @@ int decoder_UpdateVideoOutput( decoder_t *dec,
vlc_video_context *vctx_out )
vlc_ureduce( &dec->fmt_out.video.i_sar_num, &dec->fmt_out.video.i_sar_den,
dec->fmt_out.video.i_sar_num,
dec->fmt_out.video.i_sar_den, 50000 );
+ unsigned int v;
if( vlc_fourcc_IsYUV( dec->fmt_out.video.i_chroma ) )
{
for( unsigned int i = 0; dsc && i < dsc->plane_count; i++ )
{
- while( dec->fmt_out.video.i_width % dsc->p[i].w.den )
- dec->fmt_out.video.i_width++;
- while( dec->fmt_out.video.i_height % dsc->p[i].h.den )
- dec->fmt_out.video.i_height++;
+ unsigned int extra_padding;
+ extra_padding = dec->fmt_out.video.i_width % dsc->p[i].w.den;
+ if (extra_padding != 0)
+ {
+ if (unlikely(ckd_add(&v, dec->fmt_out.video.i_width,
dsc->p[i].w.den - extra_padding)))
+ {
+ msg_Err( dec, "Cannot add %u to the decoder width %u",
+ dsc->p[i].w.den - extra_padding,
+ dec->fmt_out.video.i_width );
+ return -1;
+ }
+ dec->fmt_out.video.i_width = v;
+ }
+
+ extra_padding = dec->fmt_out.video.i_height % dsc->p[i].h.den;
+ if (extra_padding != 0)
+ {
+ if (unlikely(ckd_add(&v, dec->fmt_out.video.i_height,
dsc->p[i].h.den - extra_padding)))
+ {
+ msg_Err( dec, "Cannot add %u to the decoder height %u",
+ dsc->p[i].h.den - extra_padding,
+ dec->fmt_out.video.i_height );
+ return -1;
+ }
+ dec->fmt_out.video.i_height = v;
+ }
}
}
@@ -185,8 +210,8 @@ int decoder_UpdateVideoOutput( decoder_t *dec,
vlc_video_context *vctx_out )
}
}
- assert(dec->fmt_out.video.i_visible_width + dec->fmt_out.video.i_x_offset
<= dec->fmt_out.video.i_width);
- assert(dec->fmt_out.video.i_visible_height + dec->fmt_out.video.i_y_offset
<= dec->fmt_out.video.i_height);
+ assert(!ckd_add(&v, dec->fmt_out.video.i_visible_width,
dec->fmt_out.video.i_x_offset) && v <= dec->fmt_out.video.i_width);
+ assert(!ckd_add(&v, dec->fmt_out.video.i_visible_height,
dec->fmt_out.video.i_y_offset) && v <= dec->fmt_out.video.i_height);
video_format_AdjustColorSpace( &dec->fmt_out.video );
View it on GitLab:
https://code.videolan.org/videolan/vlc/-/compare/80e62b79d0bf7ea35c158c5c0bb21a40b2878dd9...746f0da32a0c0c358e8c56c71b58579369ae9a1e
--
View it on GitLab:
https://code.videolan.org/videolan/vlc/-/compare/80e62b79d0bf7ea35c158c5c0bb21a40b2878dd9...746f0da32a0c0c358e8c56c71b58579369ae9a1e
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits