Browse Source

img2txt: fix uninitialised data in BMP loader.

tags/v0.99.beta20
Sam Hocevar 6 years ago
parent
commit
0b580d6630
1 changed files with 5 additions and 5 deletions
  1. +5
    -5
      src/common-image.c

+ 5
- 5
src/common-image.c View File

@@ -271,7 +271,7 @@ void unload_image(struct image * im)
#if !defined(USE_IMLIB2)
static unsigned int u32fread(caca_file_t * f)
{
uint8_t buffer[4];
uint8_t buffer[4] = { 0 };
caca_file_read(f, buffer, 4);
return ((unsigned int)buffer[3] << 24) | ((unsigned int)buffer[2] << 16)
| ((unsigned int)buffer[1] << 8) | ((unsigned int)buffer[0]);
@@ -279,16 +279,16 @@ static unsigned int u32fread(caca_file_t * f)

static unsigned int u16fread(caca_file_t * f)
{
uint8_t buffer[2];
uint8_t buffer[2] = { 0 };
caca_file_read(f, buffer, 2);
return ((unsigned int)buffer[1] << 8) | ((unsigned int)buffer[0]);
}

static unsigned int u8fread(caca_file_t * f)
{
uint8_t buffer;
caca_file_read(f, &buffer, 1);
return (unsigned int)buffer;
uint8_t buffer[1] = { 0 };
caca_file_read(f, buffer, 1);
return (unsigned int)buffer[0];
}
#endif


Loading…
Cancel
Save