Appease ubsan
authorEmilia Kasper <emilia@openssl.org>
Wed, 11 May 2016 20:41:29 +0000 (22:41 +0200)
committerEmilia Kasper <emilia@openssl.org>
Thu, 12 May 2016 16:47:06 +0000 (18:47 +0200)
ERR_LIB_USER has value 128, and shifting into the sign bit upsets the
shift sanitizer.

Reviewed-by: Rich Salz <rsalz@openssl.org>
include/openssl/err.h

index e41fdc3efe8339bebd0a54bd19a0fc6136d1a988..ce3283ebd5887f3409816fb6bdfa22389783abb9 100644 (file)
@@ -235,7 +235,7 @@ typedef struct err_state_st {
 # define KDFerr(f,r) ERR_PUT_error(ERR_LIB_KDF,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
 
 # define ERR_PACK(l,f,r) \
-    ( (((l) & 0x0FF) << 24L) | (((f) & 0xFFF) << 12L) | ((r) & 0xFFF) )
+  ( ((unsigned int)((l) & 0x0FF) << 24L) | (((f) & 0xFFF) << 12L) | ((r) & 0xFFF) )
 # define ERR_GET_LIB(l)          (int)((((unsigned long)l)>>24L)&0xffL)
 # define ERR_GET_FUNC(l)         (int)((((unsigned long)l)>>12L)&0xfffL)
 # define ERR_GET_REASON(l)       (int)((l)&0xfffL)