Closed Bug 678993 Opened 9 years ago Closed 9 years ago

null pointer dereference in firefox-src/nsprpub/lib/msgc/src/prmsgc.c

Categories

(NSPR :: NSPR, defect, P2, minor)

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: david.volgyes, Assigned: wtc)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20100101 Firefox/5.0
Build ID: 20110622232440

Steps to reproduce:

cppcheck 1.49 (http://cppcheck.sourceforge.net/) found a plenty of potential null pointer dereference. This is one of them.


Actual results:

There is an interesting function in the file called 'prmsgc.c'.
This is it: 
static void EarthShatteringKaBoom(PRInt32 whichOne) {
    long* p = 0;
    *p = 0;
}

Obviously, this will cause a null pointer dereference at every call.
The question is that: is this function called at least once? Yes.
(Another interesting solution: it is called with argument 0,1 or 3. Why?)


Expected results:

I think this was some kind of assertion. But I think this is a very bad pattern, and it should be replaced with some proper error handling.
Assignee: nobody → wtc
Component: General → NSPR
Product: Firefox → NSPR
QA Contact: general → nspr
Version: Trunk → other
Thank you for the bug report.  The code in mozilla/nsprpub/lib/msgc
is dead code.  It is not being used.  So it is not worthwhile to
fix that code.

Please configure cppcheck to exclude the entire
mozilla/nsprpub/lib/msgc directory, or treat the
EarthShatteringKaBoom() function as an abort/exit function.
Severity: normal → minor
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
OS: Linux → All
Priority: -- → P2
Hardware: x86_64 → All
Resolution: --- → WONTFIX
Target Milestone: --- → 4.9
Patch checked in on the NSPR trunk (NSPR 4.9).
Note that I plan to remove the lib/msgc directory
from the CVS repository soon.  This patch gets it
to build (in the objdir build configuration) before
I CVS remove it.

Checking in lib/msgc/include/Makefile.in;
/cvsroot/mozilla/nsprpub/lib/msgc/include/Makefile.in,v  <--  Makefile.in
new revision: 1.12; previous revision: 1.11
done
Checking in lib/msgc/src/Makefile.in;
/cvsroot/mozilla/nsprpub/lib/msgc/src/Makefile.in,v  <--  Makefile.in
new revision: 1.16; previous revision: 1.15
done
I removed the mozilla/nsprpub/lib/msgc directory from CVS
on the NSPR trunk (NSPR 4.9).

Removing lib/msgc/.cvsignore;
/cvsroot/mozilla/nsprpub/lib/msgc/.cvsignore,v  <--  .cvsignore
new revision: delete; previous revision: 1.2
done
Removing lib/msgc/Makefile.in;
/cvsroot/mozilla/nsprpub/lib/msgc/Makefile.in,v  <--  Makefile.in
new revision: delete; previous revision: 1.8
done
Removing lib/msgc/include/.cvsignore;
/cvsroot/mozilla/nsprpub/lib/msgc/include/.cvsignore,v  <--  .cvsignore
new revision: delete; previous revision: 1.2
done
Removing lib/msgc/include/Makefile.in;
/cvsroot/mozilla/nsprpub/lib/msgc/include/Makefile.in,v  <--  Makefile.in
new revision: delete; previous revision: 1.12
done
Removing lib/msgc/include/gcint.h;
/cvsroot/mozilla/nsprpub/lib/msgc/include/gcint.h,v  <--  gcint.h
new revision: delete; previous revision: 3.6
done
Removing lib/msgc/include/prgc.h;
/cvsroot/mozilla/nsprpub/lib/msgc/include/prgc.h,v  <--  prgc.h
new revision: delete; previous revision: 3.7
done
Removing lib/msgc/src/.cvsignore;
/cvsroot/mozilla/nsprpub/lib/msgc/src/.cvsignore,v  <--  .cvsignore
new revision: delete; previous revision: 1.2
done
Removing lib/msgc/src/Makefile.in;
/cvsroot/mozilla/nsprpub/lib/msgc/src/Makefile.in,v  <--  Makefile.in
new revision: delete; previous revision: 1.16
done
Removing lib/msgc/src/os2gc.c;
/cvsroot/mozilla/nsprpub/lib/msgc/src/os2gc.c,v  <--  os2gc.c
new revision: delete; previous revision: 3.6
done
Removing lib/msgc/src/prgcapi.c;
/cvsroot/mozilla/nsprpub/lib/msgc/src/prgcapi.c,v  <--  prgcapi.c
new revision: delete; previous revision: 3.8
done
Removing lib/msgc/src/prmsgc.c;
/cvsroot/mozilla/nsprpub/lib/msgc/src/prmsgc.c,v  <--  prmsgc.c
new revision: delete; previous revision: 3.12
done
Removing lib/msgc/src/unixgc.c;
/cvsroot/mozilla/nsprpub/lib/msgc/src/unixgc.c,v  <--  unixgc.c
new revision: delete; previous revision: 3.6
done
Removing lib/msgc/src/win32gc.c;
/cvsroot/mozilla/nsprpub/lib/msgc/src/win32gc.c,v  <--  win32gc.c
new revision: delete; previous revision: 3.5
done
Removing lib/msgc/tests/.cvsignore;
/cvsroot/mozilla/nsprpub/lib/msgc/tests/.cvsignore,v  <--  .cvsignore
new revision: delete; previous revision: 1.2
done
Removing lib/msgc/tests/Makefile.in;
/cvsroot/mozilla/nsprpub/lib/msgc/tests/Makefile.in,v  <--  Makefile.in
new revision: delete; previous revision: 1.17
done
Removing lib/msgc/tests/gc1.c;
/cvsroot/mozilla/nsprpub/lib/msgc/tests/gc1.c,v  <--  gc1.c
new revision: delete; previous revision: 3.7
done
Removing lib/msgc/tests/thrashgc.c;
/cvsroot/mozilla/nsprpub/lib/msgc/tests/thrashgc.c,v  <--  thrashgc.c
new revision: delete; previous revision: 3.6
done
Blocks: cppcheck
You need to log in before you can comment on or make changes to this bug.