Rémi Denis-Courmont pushed to branch master at VideoLAN / VLC


Commits:
8d5dfed5 by Rémi Denis-Courmont at 2024-01-17T06:42:59+00:00
udisks: fix off-by-one

Refs #28486.

- - - - -


1 changed file:

- modules/services_discovery/udisks.c


Changes:

=====================================
modules/services_discovery/udisks.c
=====================================
@@ -101,8 +101,12 @@ static int human(uint64_t *i)
 {
     if (i == 0)
         return 0;
+
     unsigned exp = (stdc_bit_width(*i) - 1) / 10;
-    exp = (exp < ARRAY_SIZE(binary_prefixes)) ? exp : 
ARRAY_SIZE(binary_prefixes);
+
+    if (exp >= ARRAY_SIZE(binary_prefixes))
+        exp = ARRAY_SIZE(binary_prefixes) - 1;
+
     *i >>= (10 * exp);
     return exp;
 }



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/8d5dfed586a14f27038570840cf82d0c14cb1af7

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/8d5dfed586a14f27038570840cf82d0c14cb1af7
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance
_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to