[PATCH] lib: zlib: Use post-increment only in inffast.c.

Tom Rini trini at konsulko.com
Mon Nov 21 16:40:20 CET 2022


On Sun, Sep 11, 2022 at 04:46:37PM +0800, Jit Loon Lim wrote:

> From: Chin Liang See <chin.liang.see at intel.com>
> 
> An old inffast.c optimization turns out to not be optimal anymore
> with modern compilers, and furthermore was not compliant with the
> C standard, for which decrementing a pointer before its allocated
> memory is undefined. Per the recommendation of a security audit of
> the zlib code by Trail of Bits and TrustInSoft, in support of the
> Mozilla Foundation, this "optimization" was removed, in order to
> avoid the possibility of undefined behavior.
> 
> This is a backport of commit 9aaec95e82117 from the upstream zlib
> project.
> 
> Signed-off-by: Mark Adler <madler at alumni.caltech.edu>
> Signed-off-by: Chin Liang See <chin.liang.see at intel.com>
> Signed-off-by: Jit Loon Lim <jit.loon.lim at intel.com>

I was about to apply this with a slightly updated commit message and
then I discovered that this causes at least the following tests to fail
in CI on sandbox:
FAILED test/py/tests/test_fit.py::test_fit - AssertionError: Kernel not loaded
FAILED test/py/tests/test_ut.py::test_ut[ut_dm_dm_test_video_bmp16] - ValueError: U-Boot exi...
FAILED test/py/tests/test_ut.py::test_ut[ut_dm_dm_test_video_bmp24] - ValueError: U-Boot exi...
FAILED test/py/tests/test_ut.py::test_ut[ut_dm_dm_test_video_bmp24_32] - ValueError: U-Boot ...
FAILED test/py/tests/test_fs/test_squashfs/test_sqfs_load.py::test_sqfs_load - AssertionError
FAILED test/py/tests/test_fs/test_squashfs/test_sqfs_ls.py::test_sqfs_ls - AssertionError
Given that the sqfs ones are saying the data is corrupt, I'm unsure if
the problem is the code or the patch here.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20221121/4a0d829b/attachment.sig>


More information about the U-Boot mailing list