Changeset ebb1489 in mainline for uspace/lib/gfximage/src/tga.c


Ignore:
Timestamp:
2024-10-13T08:23:40Z (2 months ago)
Author:
GitHub <noreply@…>
Children:
0472cf17
Parents:
2a0c827c (diff), b3b79981 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
boba-buba <120932204+boba-buba@…> (2024-10-13 08:23:40)
git-committer:
GitHub <noreply@…> (2024-10-13 08:23:40)
Message:

Merge branch 'HelenOS:master' into topic/packet-capture

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/gfximage/src/tga.c

    r2a0c827c rebb1489  
    155155        tga->img_alpha_dir = (head->img_descr & 0xf0) >> 4;
    156156        tga->img_data = tga->cmap_data + tga->cmap_length;
    157         tga->img_length = ALIGN_UP(tga->width * tga->height * tga->img_bpp, 8) >> 3;
     157
     158        uint64_t length = (uint64_t) tga->width * tga->height * tga->img_bpp;
     159        if (length & 0x7)
     160                length += 8;
     161        length >>= 3;
     162
     163        if (length > SIZE_MAX - sizeof(tga_header_t) - tga->id_length -
     164            tga->cmap_length)
     165                return false;
     166
     167        tga->img_length = length;
    158168
    159169        if (size < sizeof(tga_header_t) + tga->id_length +
Note: See TracChangeset for help on using the changeset viewer.