Skip to content

Commit

Permalink
jpeg unpacking - handle decode failure
Browse files Browse the repository at this point in the history
  • Loading branch information
matkatz committed Aug 12, 2019
1 parent e2a0c62 commit 1438f3b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -938,9 +938,14 @@ namespace librealsense
//STBIDEF stbi_uc *stbi_load_from_memory(stbi_uc const *buffer, int len, int *x, int *y, int *comp, int req_comp)
int w, h, bpp;
auto uncompressed_rgb = stbi_load_from_memory(source, actual_size, &w, &h, &bpp, false);
auto uncompressed_size = w * h * bpp;
librealsense::copy(dest[0], uncompressed_rgb, uncompressed_size);
stbi_image_free(uncompressed_rgb);
if (uncompressed_rgb)
{
auto uncompressed_size = w * h * bpp;
librealsense::copy(dest[0], uncompressed_rgb, uncompressed_size);
stbi_image_free(uncompressed_rgb);
}
else
LOG_ERROR("jpeg decode failed");
}

//////////////////////////////////////
Expand Down

0 comments on commit 1438f3b

Please sign in to comment.