diff --git a/type/PNG.py b/type/PNG.py index e2cc200..9d130f8 100644 --- a/type/PNG.py +++ b/type/PNG.py @@ -149,6 +149,15 @@ class PNG: data[height_begin: height_begin+4] = height.to_bytes(4, byteorder='big') print(f'[*] 已将图片高度设置为{height}') changed = True + + chunk_data = data[data_begin: data_begin+length] + if not PNG.test_ihdr_chunk(ctype + chunk_data, crc): + print('[x] 修复CRC校验码') + chunk = ctype + chunk_data + crc32 = binascii.crc32(chunk) & 0xffffffff + data[data_begin+length:data_begin+length+4] = crc32.to_bytes(4, byteorder='big') + changed = True + b = True return changed, data, width, height @staticmethod