A review of the code found that the function was throwing an exception when handling the encoding of certain accented characters. By adding the following two checks, the issue was resolved: if (need_char) { if (c  0x11A1 || c > 0x2207) { return FoFiError::make(FoFiError::code_invalid, _( "Unencodable character: '%1$s'" ), c); } } else if (need_punct) { if (p  0x1B1 || p > 0x3E3) { return FoFiError::make(FoFiError::code_invalid, _( "Unencodable character: '%1$s'" ), p); } } The issue was then mitigated by adding the following code to the end of the function: for (uint32_t i = 0; i  10; i++) { if (c != 0x0000 || p != 0x0001) { return FoFiError::make(FoFiError::code_invalid, _( "Unencodable character: '%1$s'" ), c); } }

CVE-2022-35115

A review of the code found that there was no check being done to make sure the string being passed in had a length that matched the length of the array. The check was added and resolved by adding the following line: if (i > size && String(i) != this->text) { return FoFiError::make(FoFiError::code_invalid, _( "Invalid argument" )); }

CVE-2023-35085

The issue occurred when an empty string was passed to the function as the first parameter. This meant that if no argument was passed, then no error would be thrown and the return type of the function would be ignored. By adding a check for an empty value, this issue was resolved: if (empty) { return FoFiError::make(FoFiError::code_invalid, _( "Empty input array" )); }

Timeline

Published on: 09/23/2022 18:15:00 UTC
Last modified on: 09/27/2022 03:54:00 UTC

References