diff options
author | Jan Engelhardt <[email protected]> | 2024-05-21 18:48:08 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2024-05-21 18:48:08 +0000 |
commit | a2636bd4ae2c9ed1b4a4a01324300ed1432fd40d (patch) | |
tree | f5e431c3440a08b2f95b5d7be4ee07e86a1321c9 /tests/parser/emailAddressTest.cpp | |
parent | vmime: prevent loss of a space during text::createFromString (#306) (diff) | |
download | vmime-a2636bd4ae2c9ed1b4a4a01324300ed1432fd40d.tar.gz vmime-a2636bd4ae2c9ed1b4a4a01324300ed1432fd40d.zip |
asciiPercent computation: another potential multiplication overflow (#307)
* build: resolve a -Wconversion compiler warning
wordEncoder.cpp:312:91: warning: conversion from
‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned
int’} to ‘double’ may change value [-Wconversion]
312 | buffer.length() == 0 ? 1 : static_cast<double>(asciiCount) / buffer.length();
| ~~~~~~~~~~~~~^~
* wordEncoder: replace value 100 for asciiPercent
asciiPercent is a ratio, and not counting in units of hundredths
anymore. The maximum value therefore should be 1 not 100.
* vmime: avoid integer multiply wraparound in text::createFromString
The change from commit v0.9.2-194-gb447adbe needs to be applied to
one more function that replicates the same code.
(If the input string is 42949673 characters long or larger, there will
be integer overflow on 32-bit platforms when multiplying by 100.
Switch that one computation to floating point.)
Diffstat (limited to 'tests/parser/emailAddressTest.cpp')
0 files changed, 0 insertions, 0 deletions