From 7148f8b58d02108606103b198d3738d9791e9db3 Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Sat, 3 Oct 2026 13:18:43 +0800 Subject: [PATCH] =?UTF-8?q?test(zlib-dbg):=20=E5=8A=A0=20UINT8PTR/BYTEPTR?= =?UTF-8?q?=20=E5=85=83=E7=B4=A0=E7=AC=A6=E5=8F=B7=E6=80=A7=E5=AF=B9?= =?UTF-8?q?=E6=8B=8D=EF=BC=8C=E9=AA=8C=E8=AF=81=E5=AD=97=E8=8A=82>=3D128?= =?UTF-8?q?=20=E8=A2=AB=E7=AC=A6=E5=8F=B7=E6=89=A9=E5=B1=95=E7=9A=84?= =?UTF-8?q?=E5=81=87=E8=AE=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZlibDbg/App/main.vp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ZlibDbg/App/main.vp b/ZlibDbg/App/main.vp index 55fc068..5f73c98 100644 --- a/ZlibDbg/App/main.vp +++ b/ZlibDbg/App/main.vp @@ -90,6 +90,19 @@ def count_freqs_probe(seed: t.CSizeT, size: t.CSizeT, repeating: t.CInt): zdeflate.zdeflate_count_freqs(lit, dist, s, data, size) s.destroy() + # 元素符号性对拍:UINT8PTR 若被当作**有符号 i8**,则字节 ≥128 读成负数 + # (-56 >= 128 恒假),既导致 count 阶段 lit_freqs[负数] 写到数组之前(漏计), + # 也让 encode_symbol(data[pos]) 收到负 symbol 被静默丢弃 ⇒ 码流截断。 + up: UINT8PTR = UINT8PTR(data) + ge8_up: t.CInt = 0 + ge8_bp: t.CInt = 0 + i: t.CSizeT + for i in range(size): + if up[i] >= 128: ge8_up += 1 + if data[i] >= 128: ge8_bp += 1 + testcheck.info(f"[countprobe] >=128 计数: UINT8PTR={ge8_up} BYTEPTR={ge8_bp} " + f"(两者应相等且≈一半)") + sum_lit: t.CInt = 0 active: t.CInt = 0 k: t.CInt