mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-23 15:56:59 +08:00
fix(lodepng): check that src is not null before calling memcpy (#8791)
This commit is contained in:
@@ -3029,8 +3029,13 @@ static unsigned lodepng_chunk_createv(ucvector * out,
|
||||
unsigned char * chunk;
|
||||
CERROR_TRY_RETURN(lodepng_chunk_init(&chunk, out, length, type));
|
||||
|
||||
/*3: the data*/
|
||||
lodepng_memcpy(chunk + 8, data, length);
|
||||
/* 3: the data
|
||||
* LVGL: In the upstream lodepng code, lodepng_memcpy doesn't use memcpy and instead uses a simple `for` loop to copy the data into its destination
|
||||
* `lv_memcpy`, on the other hand, may call `memcpy` under the hood and `src` can't be NULL
|
||||
* The function `addChunk_IEND` is an example of a function that calls this function with data == NULL*/
|
||||
if(data) {
|
||||
lodepng_memcpy(chunk + 8, data, length);
|
||||
}
|
||||
|
||||
/*4: CRC (of the chunkname characters and the data)*/
|
||||
lodepng_chunk_generate_crc(chunk);
|
||||
|
||||
Reference in New Issue
Block a user