-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Description
Lines 69 to 71 in 2896db6
| /* in case user likes doing a byte at a time, keep it fast */ | |
| if (len == 1) { | |
| adler += buf[0]; |
Suspicious to code analyzer is dereferencing
buf while the pointer is checked for null later.
The function declared as ZEXPORT presumably could be called by user with these arguments: adler32_z(0, NULL, 1).
Code could be made safe by moving the NULL check up, before the quoted code.
The point of keeping it fast is a small excuse, because making a call for every single byte is certainly not about speed, while the additional check needs only two instructions (at least, for x86/x64).
The warning could be suppressed by replacing buf == Z_NULL with len == 0, but the code would be less safe.
Metadata
Metadata
Assignees
Labels
No labels