| 4435 | } |
| 4436 | |
| 4437 | static int stbi__parse_zlib_header(stbi__zbuf *a) |
| 4438 | { |
| 4439 | int cmf = stbi__zget8(a); |
| 4440 | int cm = cmf & 15; |
| 4441 | /* int cinfo = cmf >> 4; */ |
| 4442 | int flg = stbi__zget8(a); |
| 4443 | if (stbi__zeof(a)) return stbi__err("bad zlib header","Corrupt PNG"); // zlib spec |
| 4444 | if ((cmf*256+flg) % 31 != 0) return stbi__err("bad zlib header","Corrupt PNG"); // zlib spec |
| 4445 | if (flg & 32) return stbi__err("no preset dict","Corrupt PNG"); // preset dictionary not allowed in png |
| 4446 | if (cm != 8) return stbi__err("bad compression","Corrupt PNG"); // DEFLATE required for png |
| 4447 | // window = 1 << (8 + cinfo)... but who cares, we fully buffer output |
| 4448 | return 1; |
| 4449 | } |
| 4450 | |
| 4451 | static const stbi_uc stbi__zdefault_length[STBI__ZNSYMS] = |
| 4452 | { |
no test coverage detected