mirror of https://github.com/adamdruppe/arsd.git
allow files that have stuff after the image end chunk
This commit is contained in:
parent
479ff1f2e6
commit
aa838cd2aa
5
png.d
5
png.d
|
|
@ -749,7 +749,7 @@ PNG* readPng(in ubyte[] data) {
|
||||||
|
|
||||||
size_t pos = 8;
|
size_t pos = 8;
|
||||||
|
|
||||||
while(pos < data.length) {
|
while(pos < data.length && data.length - pos >= 12) {
|
||||||
Chunk n;
|
Chunk n;
|
||||||
n.size |= data[pos++] << 24;
|
n.size |= data[pos++] << 24;
|
||||||
n.size |= data[pos++] << 16;
|
n.size |= data[pos++] << 16;
|
||||||
|
|
@ -771,6 +771,9 @@ PNG* readPng(in ubyte[] data) {
|
||||||
n.checksum |= data[pos++] << 0;
|
n.checksum |= data[pos++] << 0;
|
||||||
|
|
||||||
p.chunks ~= n;
|
p.chunks ~= n;
|
||||||
|
|
||||||
|
if(n.type == "IEND")
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue