Closed
Bug 216952
Opened 22 years ago
Closed 1 year ago
isdigit() used incorrectly throughout codebase (use mozilla::IsAsciiDigit())
Categories
(Developer Infrastructure :: Source Code Analysis, task)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: am_spm, Unassigned)
References
(Depends on 2 open bugs)
Details
(Whiteboard: bugday0420)
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 1.0.3705)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5b) Gecko/20030820
isdigit() called with incorrect parameter. isdigit() should be called with
either an EOF or a value that can be represented as an unsigned char.
It's called with a char in these cases. Negative values aside from EOF cause
undefined results from isdigit, and cause an assertion under
MSVC.NET (vc7).
The following locations contain bad calls to isdigit():
mozilla\gc\boehm\typeinfo.cpp(187): while (isdigit(*type))
++type;
mozilla\htmlparser\tests\outsinks\Convert.cpp(244): if (isdigit(argv[0]
[2]))
mozilla\htmlparser\tests\outsinks\Convert.cpp(254): if (isdigit(argv[0]
[2]))
mozilla\mailnews\extensions\bayesian-spam-filter\src\nsBayesianFilter.cpp
(232): if (!isdigit(c))
mozilla\mailnews\imap\src\nsImapSearchResults.cpp(118): while (isdigit
(*++fPositionInCurrentLine))
mozilla\mailnews\imap\src\nsImapServerResponseParser.cpp(2755): if (!
isdigit(string[i]))
// Unsure? nsCAutoString line;
mozilla\netwerk\protocol\ftp\src\nsFtpConnectionThread.cpp
(496): isdigit(line[0]) &&
mozilla\netwerk\protocol\ftp\src\nsFtpConnectionThread.cpp
(497): isdigit(line[1]) &&
mozilla\netwerk\protocol\ftp\src\nsFtpConnectionThread.cpp
(498): isdigit(line[2]));
// Numerous occassions in ParseFTPList.cpp
mozilla\netwerk\streamconv\converters\ParseFTPList.cpp(149): if
(isdigit(line[pos]))
mozilla\xpinstall\wizard\libxpnet\src\nsFTPConn.cpp(520): while (!isdigit
((int)(*c)))
mozilla\xpinstall\wizard\libxpnet\src\nsSocket.cpp(512): else if (!
isdigit(aAddress[i]))
mozilla\xpinstall\wizard\windows\ds32\ds32.cpp
(409): if(isdigit(argv[i][2]) == 0)
mozilla\xpinstall\wizard\windows\ds32\ds32.cpp
(417): if(isdigit(argv[i][0]) == 0)
Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Actual Results:
VC7 causes an assertion. Man pages under RedHat Linux 7.1 also indicate that
isdigit() should be called with an int parameter with either EOF or a value in
the range of an unsigned char. Other projects seem to indicate that other
platforms aside from Windows VC7 debug builds have problems with isdigit()
being passed invalid values as well.
This causes a debug build of a clean checkout compiled with Vc7 to be hardly
usable as isdigit() causes asserts like crazy - especially in the mail portion.
Expected Results:
char c;
isdigit((unsigned char)c)
?
-> Build config
Is this the right place for this bug? I've had problems with MSVC 7 asserting
like crazy as well.
Assignee: general → mozbugs-build
Status: UNCONFIRMED → NEW
Component: Browser-General → Build Config
Ever confirmed: true
This is a general coding bug not a build/config bug.
Assignee: mozbugs-build → general
Component: Build Config → Browser-General
Updated•21 years ago
|
Product: Browser → Seamonkey
Comment 4•20 years ago
|
||
Not a blocker. Should use NS_IS_DIGIT() instead
Severity: blocker → normal
Summary: isdigit() used incorrectly throughout codebase → isdigit() used incorrectly throughout codebase (use NS_IS_DIGIT)
Updated•15 years ago
|
Assignee: general → nobody
Product: SeaMonkey → Core
QA Contact: general → general
Updated•15 years ago
|
Whiteboard: bugday0420
Summary: isdigit() used incorrectly throughout codebase (use NS_IS_DIGIT) → isdigit() used incorrectly throughout codebase (use mozilla::IsAsciiDigit())
Per https://stackoverflow.com/questions/2898228/can-isdigit-legitimately-be-locale-dependent-in-c isdigit() depends on the locale on Windows in violation of the C standard.
Depends on: 1485340
Depends on: 1485342
Depends on: 1485343
Depends on: 1485587
See Also: → 1485588
Depends on: 1485590
Depends on: 1485592
Depends on: 1485593
Depends on: 1486385
Depends on: 1486386
Updated•3 years ago
|
Severity: normal → S3
Comment 6•1 year ago
|
||
Closing as I guess it is fixed. Please reopen if I am wrong
Status: NEW → RESOLVED
Type: defect → task
Closed: 1 year ago
Component: General → Source Code Analysis
Product: Core → Developer Infrastructure
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•