Last Comment Bug 390554 - all PKIX_NULLCHECK_ errors are reported as "PKIX ALLOC ERROR"
: all PKIX_NULLCHECK_ errors are reported as "PKIX ALLOC ERROR"
Status: RESOLVED FIXED
PKIX
:
Product: NSS
Classification: Components
Component: Libraries (show other bugs)
: trunk
: All All
: P1 normal (vote)
: 3.12
Assigned To: Alexei Volkov
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-08-01 16:18 PDT by Alexei Volkov
Modified: 2007-11-08 15:50 PST (History)
1 user (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments

Description Alexei Volkov 2007-08-01 16:18:24 PDT
Many pkix function have input arguments check. The check is done by PKIX_NULLCHECK_{ONE,TWO,THREE,FOUR} macros. If NULL check fails, then
libpkix misleadingly reports such error as "PKIX ALLOC ERROR".
Comment 1 Nelson Bolyard (seldom reads bugmail) 2007-08-01 19:12:32 PDT
I think this is P2, if not P1.  This will cause us no end of headache.
People will get these errors and report that NSS is leaking memory, etc.
Comment 2 Nelson Bolyard (seldom reads bugmail) 2007-08-01 19:22:30 PDT
The PKIX_NULLCHECK_{ONE,TWO,THREE,FOUR} macros all set the error code
PKIX_NULLARGUMENT, for which the error string is "Null argument".

include/pkix_errorstrings.h:693:PKIX_ERRORENTRY(NULLARGUMENT,Null argument),
The "PKIX ALLOC ERROR" string is for PKIX_ALLOC_ERROR.  See
http://lxr.mozilla.org/security/source/security/nss/lib/libpkix/pkix_pl_nss/system/pkix_pl_lifecycle.c#52

So, where/how does PKIX_NULLARGUMENT get turned into PKIX_ALLOC_ERROR ??
Comment 3 Nelson Bolyard (seldom reads bugmail) 2007-08-01 19:45:10 PDT
Steve, DO you know how PKIX_NULLARGUMENT gets turned into PKIX_ALLOC_ERROR ?
Comment 4 Steve Parkinson 2007-08-02 10:20:48 PDT
I'm afraid I don't.
Comment 5 Nelson Bolyard (seldom reads bugmail) 2007-08-02 10:49:19 PDT
If someone can give me a reproducible test case for this (may need a test 
program) I am willing to dig into it.
Comment 6 Nelson Bolyard (seldom reads bugmail) 2007-09-27 16:52:52 PDT
In a patch for another bug, Alexei included a one line patch for THIS bug.
It was:

Index: lib/libpkix/pkix/util/pkix_tools.h
 
 #define PKIX_ERROR_FATAL(descNum) \
     { \
 	pkixErrorReceived = PKIX_TRUE; \
 	pkixErrorMsg = PKIX_ErrorText[descNum]; \
+	pkixErrorCode = descNum; \
 	_PKIX_LOG_ERROR(pkixErrorMsg, PKIX_LOGGER_LEVEL_FATALERROR); \
 	PKIX_RETURN(FATAL); \
     }

I give r+ to the above tiny patch here.  That patch should be checked in 
by itself, separately from the patch for that other bug, with a comment 
pointing out that it is the fix for this bug.
Comment 7 Alexei Volkov 2007-11-08 15:50:22 PST
Fixed by patch to bug 391457

Note You need to log in before you can comment on or make changes to this bug.