You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If stbi__load_gif_main in stbi_load_gif_from_memory [1] fails it returns a null pointer and may keep the z variable uninitialized. In case the caller also sets the flip vertically flag [2], it continues and calls stbi__vertical_flip_slices [3] with the null pointer result value and the uninitialized z value.
STBIDEF stbi_uc *stbi_load_gif_from_memory(stbi_uc const *buffer, int len, int **delays, int *x, int *y, int *z, int *comp, int req_comp)
{
unsignedchar *result;
stbi__context s;
stbi__start_mem(&s,buffer,len);
result = (unsignedchar*) stbi__load_gif_main(&s, delays, x, y, z, comp, req_comp); // [1]if (stbi__vertically_flip_on_load) { // [2]stbi__vertical_flip_slices( result, *x, *y, *z, *comp ); // [3]
}
return result;
}
It depends on the value of z [4] if the program enters the loop and attempts to dereference the null pointer value in stbi__vertical_flip [5].
staticvoidstbi__vertical_flip_slices(void *image, int w, int h, int z, int bytes_per_pixel)
{
int slice;
int slice_size = w * h * bytes_per_pixel;
stbi_uc *bytes = (stbi_uc *)image;
for (slice = 0; slice < z; ++slice) { // [4]stbi__vertical_flip(bytes, w, h, bytes_per_pixel); // [5]
bytes += slice_size;
}
}
Impact
This issue may lead to denial of service.
Resources
To reproduce the issue in stbi__vertical_flip_slices:
If
stbi__load_gif_main
instbi_load_gif_from_memory
[1] fails it returns a null pointer and may keep thez
variable uninitialized. In case the caller also sets the flip vertically flag [2], it continues and callsstbi__vertical_flip_slices
[3] with the null pointerresult
value and the uninitializedz
value.It depends on the value of
z
[4] if the program enters the loop and attempts to dereference the null pointer value instbi__vertical_flip
[5].Impact
This issue may lead to denial of service.
Resources
To reproduce the issue in
stbi__vertical_flip_slices
:stbi__vertical_flip_slices
and run the program to hit the usage of the uninitialized memory.The text was updated successfully, but these errors were encountered: