Describe the bug
In cbor_new_definite_map(), _CBOR_DEPENDENT_NOTNULL is used to check whether .data has been allocated.
But on some platforms, likes NI LabWindows/CVI, cbor_alloc_multiple (i.e. malloc) returns NULL when requsted size is 0.
Therefore, cannot create empty map by _CBOR_DEPENDENT_NOTNULL check.
Return value of malloc(0) is implementation-defined, so it is not possible to create empty map on some platforms.
To Reproduce
Call cbor_new_definite_map(0) in NI LabWindows/CVI
Expected behavior
Create empty map using cbor_new_definite_map(0) even if malloc(0) returns NULL.
Environment
- libcbor 0.13.0
- NI LabWindows/CVI
Describe the bug
In cbor_new_definite_map(), _CBOR_DEPENDENT_NOTNULL is used to check whether .data has been allocated.
But on some platforms, likes NI LabWindows/CVI, cbor_alloc_multiple (i.e. malloc) returns NULL when requsted size is 0.
Therefore, cannot create empty map by _CBOR_DEPENDENT_NOTNULL check.
Return value of malloc(0) is implementation-defined, so it is not possible to create empty map on some platforms.
To Reproduce
Call cbor_new_definite_map(0) in NI LabWindows/CVI
Expected behavior
Create empty map using cbor_new_definite_map(0) even if malloc(0) returns NULL.
Environment