| 4780 | } |
| 4781 | |
| 4782 | static int stbi__parse_zlib_header(stbi__zbuf* a) { |
| 4783 | int cmf = stbi__zget8(a); |
| 4784 | int cm = cmf & 15; |
| 4785 | /* int cinfo = cmf >> 4; */ |
| 4786 | int flg = stbi__zget8(a); |
| 4787 | if (stbi__zeof(a)) |
| 4788 | return stbi__err("bad zlib header", "Corrupt PNG"); // zlib spec |
| 4789 | if ((cmf * 256 + flg) % 31 != 0) |
| 4790 | return stbi__err("bad zlib header", "Corrupt PNG"); // zlib spec |
| 4791 | if (flg & 32) |
| 4792 | return stbi__err( |
| 4793 | "no preset dict", |
| 4794 | "Corrupt PNG"); // preset dictionary not allowed in png |
| 4795 | if (cm != 8) |
| 4796 | return stbi__err("bad compression", "Corrupt PNG"); // DEFLATE required for png |
| 4797 | // window = 1 << (8 + cinfo)... but who cares, we fully buffer output |
| 4798 | return 1; |
| 4799 | } |
| 4800 | |
| 4801 | static const stbi_uc stbi__zdefault_length[STBI__ZNSYMS] = { |
| 4802 | 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, |
no test coverage detected