CRC修复
parent
6fa426711b
commit
7cad780156
|
@ -149,6 +149,15 @@ class PNG:
|
||||||
data[height_begin: height_begin+4] = height.to_bytes(4, byteorder='big')
|
data[height_begin: height_begin+4] = height.to_bytes(4, byteorder='big')
|
||||||
print(f'[*] 已将图片高度设置为{height}')
|
print(f'[*] 已将图片高度设置为{height}')
|
||||||
changed = True
|
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
|
return changed, data, width, height
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
Loading…
Reference in New Issue