MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / stbi__parse_uncompressed_block

Function stbi__parse_uncompressed_block

include/stb/stb_image.h:4409–4436  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4407}
4408
4409static int stbi__parse_uncompressed_block(stbi__zbuf *a)
4410{
4411 stbi_uc header[4];
4412 int len,nlen,k;
4413 if (a->num_bits & 7)
4414 stbi__zreceive(a, a->num_bits & 7); // discard
4415 // drain the bit-packed data into header
4416 k = 0;
4417 while (a->num_bits > 0) {
4418 header[k++] = (stbi_uc) (a->code_buffer & 255); // suppress MSVC run-time check
4419 a->code_buffer >>= 8;
4420 a->num_bits -= 8;
4421 }
4422 if (a->num_bits < 0) return stbi__err("zlib corrupt","Corrupt PNG");
4423 // now fill header the normal way
4424 while (k < 4)
4425 header[k++] = stbi__zget8(a);
4426 len = header[1] * 256 + header[0];
4427 nlen = header[3] * 256 + header[2];
4428 if (nlen != (len ^ 0xffff)) return stbi__err("zlib corrupt","Corrupt PNG");
4429 if (a->zbuffer + len > a->zbuffer_end) return stbi__err("read past buffer","Corrupt PNG");
4430 if (a->zout + len > a->zout_end)
4431 if (!stbi__zexpand(a, a->zout, len)) return 0;
4432 memcpy(a->zout, a->zbuffer, len);
4433 a->zbuffer += len;
4434 a->zout += len;
4435 return 1;
4436}
4437
4438static int stbi__parse_zlib_header(stbi__zbuf *a)
4439{

Callers 1

stbi__parse_zlibFunction · 0.85

Calls 4

stbi__zreceiveFunction · 0.85
stbi__errFunction · 0.85
stbi__zget8Function · 0.85
stbi__zexpandFunction · 0.85

Tested by

no test coverage detected