тесты lab4 переведены на 202 + worker; unit-тесты pipeline; кейсы рецензий как 415

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

PNG с фильтром строки 5/0xff, IDAT не zlib, JPEG из 27 байт, SOS с компонентом не из SOF:
415 при загрузке. 40 Мпикс проходит до ready в лимите памяти worker.
This commit is contained in:
Alexey Bodanyuk
2026-10-31 16:12:52 +03:00
parent bc32a50967
commit aef6eb1d4c
8 changed files with 449 additions and 91 deletions
+24
View File
@@ -91,3 +91,27 @@ def jpeg_bomb_header() -> bytes:
"""SOF0 announcing 20000 x 20000 = 400 Mpx."""
return (b"\xff\xd8\xff\xc0\x00\x11\x08" + struct.pack(">HH", 20000, 20000)
+ b"\x03\x01\x22\x00\x02\x11\x01\x03\x11\x01" + b"\xff\xd9")
# ------------------------------------------------------------------ cases the reviewer used in lab 4/5 PRs
def png_bad_filter(filter_byte: int) -> bytes:
"""PNG 1x1 RGB, correct CRCs and zlib stream, but the row filter byte is not 0..4."""
raw = bytes([filter_byte]) + b"\x00\x00\x00"
return PNG_SIGNATURE + ihdr(1, 1) + chunk(b"IDAT", zlib.compress(raw)) + chunk(b"IEND", b"")
def png_idat_not_zlib() -> bytes:
"""Correct PNG structure, IDAT = b'not-a-zlib-stream' with a recomputed CRC."""
return PNG_SIGNATURE + ihdr(64, 64) + chunk(b"IDAT", b"not-a-zlib-stream") + chunk(b"IEND", b"")
# SOI, SOF0 1x1 grey, SOS, EOI: no tables, no scan data (27 bytes).
JPEG_27_BYTES = bytes.fromhex("ffd8ffc0000b080001000101011100ffda0008010100003f00ffd9")
def jpeg_sos_unknown_component() -> bytes:
"""A valid JPEG whose first SOS component id (byte sos+5) is 250, absent from SOF."""
data = bytearray(jpeg(64, 48))
sos = data.index(b"\xff\xda")
data[sos + 5] = 250
return bytes(data)