mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-25 14:54:39 +02:00
Fix crash in Column Editor
Avoid division by zero (due to an arithmetic overflow). Fix #15144, close #15152
This commit is contained in:
parent
bdc11a47ff
commit
d0e3a1a210
@ -165,24 +165,17 @@ LanguageNameInfo ScintillaEditView::_langNameInfoArray[L_EXTERNAL + 1] = {
|
|||||||
|
|
||||||
int getNbDigits(int aNum, int base)
|
int getNbDigits(int aNum, int base)
|
||||||
{
|
{
|
||||||
int nbChiffre = 1;
|
int nbDigits = 0;
|
||||||
int diviseur = base;
|
|
||||||
|
|
||||||
for (;;)
|
do
|
||||||
{
|
{
|
||||||
int result = aNum / diviseur;
|
++nbDigits;
|
||||||
if (!result)
|
aNum /= base;
|
||||||
break;
|
} while (aNum != 0);
|
||||||
else
|
if (base == 16 && nbDigits % 2 != 0)
|
||||||
{
|
++nbDigits;
|
||||||
diviseur *= base;
|
|
||||||
++nbChiffre;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((base == 16) && (nbChiffre % 2 != 0))
|
|
||||||
nbChiffre += 1;
|
|
||||||
|
|
||||||
return nbChiffre;
|
return nbDigits;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isCharSingleQuote(__inout wchar_t const c)
|
bool isCharSingleQuote(__inout wchar_t const c)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user