Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug: crash on non string "alg" (#48)
* release JWS resources in test code after merging #33 * fix crash when "alg" header is set to non-string; see #47 this would affect cjose_jws_sign as well as cjose_jws_import and is a potential DoS vector for the latter Signed-off-by: Hans Zandbelt <[email protected]>
- Loading branch information
b5daeb6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In function "cjose_jws_t *cjose_jws_import(const char *cser, size_t cser_len, cjose_err *err)"
My code is getting crash in "cjose_jws_release(jws);" for invalid token.
#0 0x555d2430 in __kernel_vsyscall ()
#1 0x558b3227 in raise () from /lib/libc.so.6
#2 0x558b4a63 in abort () from /lib/libc.so.6
#3 0x558f4fd5 in __libc_message () from /lib/libc.so.6
#4 0x558fdaad in _int_free () from /lib/libc.so.6
#5 0x55f0f550 in jsonp_free (ptr=0x913ad2a) at memory.c:36
#6 0x55f0d186 in hashtable_close (hashtable=hashtable@entry=0x913ad00) at hashtable.c:216
#7 0x55f1226b in json_delete_object (object=0x913acf8) at value.c:77
#8 json_delete (json=0x913acf8) at value.c:936
#9 0x556a23b9 in json_decref (json=0x913acf8) at /usr/include/jansson.h:112
#10 0x556a437c in cjose_jws_release (jws=0x912efa8) at jws.c:705
is same fix required here? or do I need to upgrade json library?
using jansson-2.10.
b5daeb6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks to me like a different issue; what does your invalid JWT header look like?
b5daeb6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its because of json-c and jansson library conflict.
json_object_get is returning only main object address and not returning the proper key object address.
My apologies.
b5daeb6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, conflicts between json-c and jansson are a nightmare. I have to rename all json-c symbols to get by.