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)

x86
All

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.
This is a general coding bug not a build/config bug.
Assignee: mozbugs-build → general
Component: Build Config → Browser-General
Product: Browser → Seamonkey
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)
Assignee: general → nobody
Product: SeaMonkey → Core
QA Contact: general → general
Whiteboard: bugday0420
Summary: isdigit() used incorrectly throughout codebase (use NS_IS_DIGIT) → isdigit() used incorrectly throughout codebase (use mozilla::IsAsciiDigit())
Severity: normal → S3

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.