Closed Bug 390554 Opened 17 years ago Closed 17 years ago

all PKIX_NULLCHECK_ errors are reported as "PKIX ALLOC ERROR"

Categories

(NSS :: Libraries, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: alvolkov.bgs, Assigned: alvolkov.bgs)

Details

(Whiteboard: PKIX)

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".
Priority: -- → P3
Whiteboard: PKIX
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.
Priority: P3 → P2
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 ??
Steve, DO you know how PKIX_NULLARGUMENT gets turned into PKIX_ALLOC_ERROR ?
Summary: libpkix reports all errors that caused by failure of PKIX_NULLCHECK_ macro as "PKIX ALLOC ERROR" → all PKIX_NULLCHECK_ errors are reported as "PKIX ALLOC ERROR"
I'm afraid I don't.
If someone can give me a reproducible test case for this (may need a test 
program) I am willing to dig into it.
Version: 3.12 → trunk
Priority: P2 → P1
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.
Fixed by patch to bug 391457
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.