mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-18 06:49:53 +02:00
webp: WEBP_OFFSET_PTR()
Removes undefined behavior of offsetting NULL. Change-Id: I7c83d0c913c631c091a5fb128f6d6b46b1d116db
This commit is contained in:
@ -193,6 +193,12 @@ extern "C" {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// If 'ptr' is NULL, returns NULL. Otherwise returns 'ptr + off'.
|
||||
// Prevents undefined behavior sanitizer nullptr-with-nonzero-offset warning.
|
||||
#if !defined(WEBP_OFFSET_PTR)
|
||||
#define WEBP_OFFSET_PTR(ptr, off) (((ptr) == NULL) ? NULL : ((ptr) + (off)))
|
||||
#endif
|
||||
|
||||
// Regularize the definition of WEBP_SWAP_16BIT_CSP (backward compatibility)
|
||||
#if !defined(WEBP_SWAP_16BIT_CSP)
|
||||
#define WEBP_SWAP_16BIT_CSP 0
|
||||
|
Reference in New Issue
Block a user