|
|
@ -1,4 +1,4 @@ |
|
|
|
/* stb_image - v2.02 - public domain image loader - http://nothings.org/stb_image.h
|
|
|
|
/* stb_image - v2.03 - public domain image loader - http://nothings.org/stb_image.h
|
|
|
|
no warranty implied; use at your own risk |
|
|
|
no warranty implied; use at your own risk |
|
|
|
|
|
|
|
|
|
|
|
Do this: |
|
|
|
Do this: |
|
|
@ -143,6 +143,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Latest revision history: |
|
|
|
Latest revision history: |
|
|
|
|
|
|
|
2.03 (2015-04-12) additional corruption checking |
|
|
|
2.02 (2015-01-19) fix incorrect assert, fix warning |
|
|
|
2.02 (2015-01-19) fix incorrect assert, fix warning |
|
|
|
2.01 (2015-01-17) fix various warnings |
|
|
|
2.01 (2015-01-17) fix various warnings |
|
|
|
2.00b (2014-12-25) fix STBI_MALLOC in progressive JPEG |
|
|
|
2.00b (2014-12-25) fix STBI_MALLOC in progressive JPEG |
|
|
@ -196,6 +197,7 @@ |
|
|
|
Sergio Gonzalez |
|
|
|
Sergio Gonzalez |
|
|
|
Cass Everitt |
|
|
|
Cass Everitt |
|
|
|
Engin Manap |
|
|
|
Engin Manap |
|
|
|
|
|
|
|
Martins Mozeiko |
|
|
|
|
|
|
|
|
|
|
|
License: |
|
|
|
License: |
|
|
|
This software is in the public domain. Where that dedication is not |
|
|
|
This software is in the public domain. Where that dedication is not |
|
|
@ -3387,10 +3389,9 @@ static int stbi__zbuild_huffman(stbi__zhuffman *z, stbi_uc *sizelist, int num) |
|
|
|
for (i=0; i < num; ++i) |
|
|
|
for (i=0; i < num; ++i) |
|
|
|
++sizes[sizelist[i]]; |
|
|
|
++sizes[sizelist[i]]; |
|
|
|
sizes[0] = 0; |
|
|
|
sizes[0] = 0; |
|
|
|
for (i=1; i < 16; ++i) { |
|
|
|
for (i=1; i < 16; ++i) |
|
|
|
STBI_ASSERT(sizes[i] <= (1 << i)); |
|
|
|
if (sizes[i] > (1 << i)) |
|
|
|
if (sizes[i] > (1 << i)) return stbi__err("bad sizes", "Corrupt PNG"); |
|
|
|
return stbi__err("bad sizes", "Corrupt PNG"); |
|
|
|
} |
|
|
|
|
|
|
|
code = 0; |
|
|
|
code = 0; |
|
|
|
for (i=1; i < 16; ++i) { |
|
|
|
for (i=1; i < 16; ++i) { |
|
|
|
next_code[i] = code; |
|
|
|
next_code[i] = code; |
|
|
@ -3567,9 +3568,9 @@ static int stbi__parse_huffman_block(stbi__zbuf *a) |
|
|
|
p = (stbi_uc *) (zout - dist); |
|
|
|
p = (stbi_uc *) (zout - dist); |
|
|
|
if (dist == 1) { // run of one byte; common in images.
|
|
|
|
if (dist == 1) { // run of one byte; common in images.
|
|
|
|
stbi_uc v = *p; |
|
|
|
stbi_uc v = *p; |
|
|
|
if (len) do *zout++ = v; while (--len); |
|
|
|
if (len) { do *zout++ = v; while (--len); } |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (len) do *zout++ = *p++; while (--len); |
|
|
|
if (len) { do *zout++ = *p++; while (--len); } |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -3597,7 +3598,6 @@ static int stbi__compute_huffman_codes(stbi__zbuf *a) |
|
|
|
n = 0; |
|
|
|
n = 0; |
|
|
|
while (n < hlit + hdist) { |
|
|
|
while (n < hlit + hdist) { |
|
|
|
int c = stbi__zhuffman_decode(a, &z_codelength); |
|
|
|
int c = stbi__zhuffman_decode(a, &z_codelength); |
|
|
|
STBI_ASSERT(c >= 0 && c < 19); |
|
|
|
|
|
|
|
if (c < 0 || c >= 19) return stbi__err("bad codelengths", "Corrupt PNG"); |
|
|
|
if (c < 0 || c >= 19) return stbi__err("bad codelengths", "Corrupt PNG"); |
|
|
|
if (c < 16) |
|
|
|
if (c < 16) |
|
|
|
lencodes[n++] = (stbi_uc) c; |
|
|
|
lencodes[n++] = (stbi_uc) c; |
|
|
@ -6205,6 +6205,7 @@ STBIDEF int stbi_info_from_callbacks(stbi_io_callbacks const *c, void *user, int |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
revision history: |
|
|
|
revision history: |
|
|
|
|
|
|
|
2.03 (2015-04-12) add extra corruption checking (mmozeiko) |
|
|
|
2.02 (2015-01-19) fix incorrect assert, fix warning |
|
|
|
2.02 (2015-01-19) fix incorrect assert, fix warning |
|
|
|
2.01 (2015-01-17) fix various warnings; suppress SIMD on gcc 32-bit without -msse2 |
|
|
|
2.01 (2015-01-17) fix various warnings; suppress SIMD on gcc 32-bit without -msse2 |
|
|
|
2.00b (2014-12-25) fix STBI_MALLOC in progressive JPEG |
|
|
|
2.00b (2014-12-25) fix STBI_MALLOC in progressive JPEG |
|
|
|