Skip to content

Commit

Permalink
fix reading of bKGD chunks for palleted images
Browse files Browse the repository at this point in the history
struct spng_bkgd.plte_index is an uint16_t, it was assumed to be uint8_t
  • Loading branch information
randy408 committed Aug 26, 2019
1 parent dcef767 commit fc1ffd6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion spng.c
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,7 @@ static int read_chunks_before_idat(spng_ctx *ctx)
if(chunk.length != 1) return SPNG_ECHUNK_SIZE;
if(!ctx->file.plte) return SPNG_EBKGD_NO_PLTE;

memcpy(&ctx->bkgd.plte_index, data, 1);
ctx->bkgd.plte_index = data[0];
if(ctx->bkgd.plte_index >= ctx->plte.n_entries) return SPNG_EBKGD_PLTE_IDX;
}

Expand Down

0 comments on commit fc1ffd6

Please sign in to comment.