]> Kevux Git Server - fll/commitdiff
Security: Floating point exception due to incorrect number type used in conversion...
authorKevin Day <thekevinday@gmail.com>
Sun, 19 Jun 2022 00:22:56 +0000 (19:22 -0500)
committerKevin Day <thekevinday@gmail.com>
Sun, 19 Jun 2022 00:22:56 +0000 (19:22 -0500)
The power is being used as the entire value.
To do this it must be capable of holding the entire supported digits of f_number_unsigned_t.
Using int results in a floating point exception.

level_0/f_conversion/c/private-conversion.c

index 72d0e67dc822fcb4541266bac7318caa84005322..248071a985c019a7f4ee3c389b08b8515b3fb846 100644 (file)
@@ -88,7 +88,7 @@ extern "C" {
   f_status_t private_f_conversion_digit_to_file_number(const f_conversion_data_t data, f_number_unsigned_t number, int digits, FILE * const stream) {
 
     f_number_unsigned_t current = 0;
-    int power = 1;
+    f_number_unsigned_t power = 1;
     f_number_unsigned_t work = 0;
 
     for (register uint8_t i = 1; i < digits; ++i) {