This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository legacy-imlib2.
View the commit online.
commit 5c226954c114f1ced7027498fd2debd34bea08f2
Author: Kim Woelders <k...@woelders.dk>
AuthorDate: Sat Jan 28 09:35:50 2023 +0100
ANI, PNG, TGA loaders: Enable handling of unaligned data
Fixes warnings seen with -fsanitize=undefined when using
--enable-packed.
---
src/modules/loaders/loader_ani.c | 2 +-
src/modules/loaders/loader_png.c | 12 ++++++------
src/modules/loaders/loader_tga.c | 2 +-
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/modules/loaders/loader_ani.c b/src/modules/loaders/loader_ani.c
index b436f46..cd38236 100644
--- a/src/modules/loaders/loader_ani.c
+++ b/src/modules/loaders/loader_ani.c
@@ -32,7 +32,7 @@ typedef struct {
const uint32_t *seq;
} riff_ctx_t;
-typedef struct {
+typedef struct __PACKED__ {
struct {
uint32_t type; // Chunk type
uint32_t size; // Chunk size
diff --git a/src/modules/loaders/loader_png.c b/src/modules/loaders/loader_png.c
index 34c5b9b..b6536d9 100644
--- a/src/modules/loaders/loader_png.c
+++ b/src/modules/loaders/loader_png.c
@@ -32,7 +32,7 @@ static const char *const _formats[] = { "png" };
#define mm_check(p) ((const char *)(p) <= (const char *)im->fi->fdata + im->fi->fsize)
-typedef struct {
+typedef struct __PACKED__ {
uint32_t len;
union {
uint32_t type;
@@ -41,7 +41,7 @@ typedef struct {
} png_chunk_hdr_t;
/* IHDR */
-typedef struct {
+typedef struct __PACKED__ {
uint32_t w; // Width
uint32_t h; // Height
uint8_t depth; // Bit depth (1, 2, 4, 8, or 16)
@@ -54,13 +54,13 @@ typedef struct {
#define _PNG_IHDR_SIZE (4 + 4 + 13 + 4)
/* acTL */
-typedef struct {
+typedef struct __PACKED__ {
uint32_t num_frames; // Number of frames
uint32_t num_plays; // Number of times to loop this APNG. 0 indicates infinite looping.
} png_actl_t;
/* fcTL */
-typedef struct {
+typedef struct __PACKED__ {
uint32_t frame; // -- // Sequence number of the animation chunk, starting from 0
uint32_t w; // -- // Width of the following frame
uint32_t h; // -- // Height of the following frame
@@ -73,12 +73,12 @@ typedef struct {
} png_fctl_t;
/* fdAT */
-typedef struct {
+typedef struct __PACKED__ {
uint32_t frame; // -- // Sequence number of the animation chunk, starting from 0
uint8_t data[];
} png_fdat_t;
-typedef struct {
+typedef struct __PACKED__ {
png_chunk_hdr_t hdr;
union {
png_ihdr_t ihdr;
diff --git a/src/modules/loaders/loader_tga.c b/src/modules/loaders/loader_tga.c
index 1f97ba9..03285d4 100644
--- a/src/modules/loaders/loader_tga.c
+++ b/src/modules/loaders/loader_tga.c
@@ -49,7 +49,7 @@ typedef struct {
unsigned char descriptor;
} tga_header;
-typedef struct {
+typedef struct __PACKED__ {
unsigned int extensionAreaOffset;
unsigned int developerDirectoryOffset;
char signature[16];
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.