Merge pull request #828 from kwagyeman/kwabena/handle_negative_bbp

Return 0 if bbp is less than 0
This commit is contained in:
Ibrahim Abd Elkader 2020-06-15 16:02:22 +02:00 committed by GitHub
commit dac4c6e673
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -236,6 +236,10 @@ void image_copy(image_t *dst, image_t *src)
size_t image_size(image_t *ptr)
{
if (ptr->bpp < 0) {
return 0;
}
switch (ptr->bpp) {
case IMAGE_BPP_BINARY: {
return IMAGE_BINARY_LINE_LEN_BYTES(ptr) * ptr->h;