[vlc-commits] [Git][videolan/vlc][master] 2 commits: extras: check the reduced values fit in the output values
Steve Lhomme (@robUx4)
gitlab at videolan.org
Mon Apr 20 08:55:37 UTC 2026
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
a88ad08b by Steve Lhomme at 2026-04-20T08:39:00+00:00
extras: check the reduced values fit in the output values
- - - - -
edda07e4 by Steve Lhomme at 2026-04-20T08:39:00+00:00
extras: replace hardcoded constant value with proper value
We don't want the maximum values in the output to be bigger than a unsigned.
- - - - -
1 changed file:
- src/extras/libc.c
Changes:
=====================================
src/extras/libc.c
=====================================
@@ -27,6 +27,8 @@
#include <vlc_charset.h>
#include <errno.h>
+#include <assert.h>
+#include <limits.h>
#undef iconv_t
#undef iconv_open
@@ -514,7 +516,7 @@ bool vlc_ureduce( unsigned *pi_dst_nom, unsigned *pi_dst_den,
i_nom /= i_gcd;
i_den /= i_gcd;
- if( i_max == 0 ) i_max = INT64_C(0xFFFFFFFF);
+ if( i_max == 0 ) i_max = UINT_MAX;
if( i_nom > i_max || i_den > i_max )
{
@@ -540,6 +542,9 @@ bool vlc_ureduce( unsigned *pi_dst_nom, unsigned *pi_dst_den,
i_den = i_a1_den;
}
+ assert(i_nom <= UINT_MAX);
+ assert(i_den <= UINT_MAX);
+
*pi_dst_nom = i_nom;
*pi_dst_den = i_den;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/5de4ef83c692e6a488643ecace22ff29b6e47453...edda07e46bf1068f4883f00455ca37cfdee36792
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/5de4ef83c692e6a488643ecace22ff29b6e47453...edda07e46bf1068f4883f00455ca37cfdee36792
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list