VERSIÓ 1.6.1:

- [FIX] Memory leaks en gif.h
- [FIX] Memory leak en backends/SDL3/input.cpp
- [FIX] Bugaco enorme i silenciós en file.cpp
- [FIX] Els arxius de font s'han de carregar com a arxius de text
- [NEW] Afegit perfil 'linux_sanitize' per a detectar problemes de memòria
This commit is contained in:
Raimon @ quifisraimon committed 2026-10-13 13:25:36 +02:00
1 parent 75ddf7ce1a
commit 9e2b89a4ee
6 files changed
+18 -14

No files matched your search

+6 -10
View File
@@ -5,6 +5,7 @@
#include <stdint.h>
#define READ(dst, size) memcpy(dst, buffer, size); buffer += size
#define SKIP(size) buffer += size
struct rgb { uint8_t r, g, b; };
@@ -116,6 +117,7 @@ void uncompress( int code_length, const uint8_t *input, int input_length, uint8_
}
out += match_len;
}
free(dictionary);
}
static int read_sub_blocks( uint8_t* buffer, uint8_t **data )
@@ -137,7 +139,7 @@ static int read_sub_blocks( uint8_t* buffer, uint8_t **data )
return data_length;
}
uint8_t* process_image_descriptor( uint8_t* buffer, rgb *gct, int gct_size, int resolution_bits )
uint8_t* process_image_descriptor( uint8_t* buffer)
{
image_descriptor_t image_descriptor;
READ(&image_descriptor, 9);
@@ -180,21 +182,15 @@ uint32_t* LoadPalette(uint8_t *buffer, uint16_t *size = NULL )
static uint8_t* LoadGif(uint8_t *buffer, uint16_t* w, uint16_t* h)
{
int global_color_table_size = 0; // number of entries in global_color_table
rgb *global_color_table = NULL;
buffer += 6; // Ignore header
*w = *((uint16_t*)buffer); buffer+=2;
*h = *((uint16_t*)buffer); buffer+=2;
const uint8_t fields = *buffer; buffer+=3;
const int color_resolution_bits = ( ( fields & 0x70 ) >> 4 ) + 1;
if ( fields & 0x80 )
{
global_color_table_size = 1 << ( ( ( fields & 0x07 ) + 1 ) );
global_color_table = (rgb*)malloc( 3 * global_color_table_size );
READ(global_color_table, 3 * global_color_table_size);
int global_color_table_size = 1 << ( ( ( fields & 0x07 ) + 1 ) );
SKIP(global_color_table_size*3);
}
uint8_t block_type = 0x0;
@@ -206,7 +202,7 @@ static uint8_t* LoadGif(uint8_t *buffer, uint16_t* w, uint16_t* h)
switch ( block_type )
{
case 0x2C:
return process_image_descriptor(buffer, global_color_table, global_color_table_size, color_resolution_bits);
return process_image_descriptor(buffer);
case 0x21:
buffer++; //size = *(buffer++); buffer += size;
do { size = *(buffer++); buffer += size; } while (size != 0);