Fix crash in Column Editor

Avoid division by zero (due to an arithmetic overflow).

Fix #15144, close #15152
pull/15157/head
cddiffz 2024-05-17 18:43:42 +02:00 committed by Don Ho
parent bdc11a47ff
commit d0e3a1a210
1 changed files with 8 additions and 15 deletions

View File

@ -165,24 +165,17 @@ LanguageNameInfo ScintillaEditView::_langNameInfoArray[L_EXTERNAL + 1] = {
int getNbDigits(int aNum, int base)
{
int nbChiffre = 1;
int diviseur = base;
int nbDigits = 0;
for (;;)
do
{
int result = aNum / diviseur;
if (!result)
break;
else
{
diviseur *= base;
++nbChiffre;
}
}
if ((base == 16) && (nbChiffre % 2 != 0))
nbChiffre += 1;
++nbDigits;
aNum /= base;
} while (aNum != 0);
if (base == 16 && nbDigits % 2 != 0)
++nbDigits;
return nbChiffre;
return nbDigits;
}
bool isCharSingleQuote(__inout wchar_t const c)