]> git.ipfire.org Git - thirdparty/zstd.git/commit - lib/legacy/zstd_v03.c
Stop suppressing pointer-overflow UBSAN errors
authorNick Terrell <terrelln@meta.com>
Wed, 27 Sep 2023 00:53:26 +0000 (17:53 -0700)
committerNick Terrell <nickrterrell@gmail.com>
Thu, 28 Sep 2023 21:35:05 +0000 (17:35 -0400)
commit43118da8a7fb51e660bfa7e958639c5cc8285580
tree24106cebc8d396d19d5d57ba69ad50c7a8b9f5bf
parent3daed7017af2f015dc34e88ff4ac1cac8cd7e511
Stop suppressing pointer-overflow UBSAN errors

* Remove all pointer-overflow suppressions from our UBSAN builds/tests.
* Add `ZSTD_ALLOW_POINTER_OVERFLOW_ATTR` macro to suppress
  pointer-overflow at a per-function level. This is a superior approach
  because it also applies to users who build zstd with UBSAN.
* Add `ZSTD_wrappedPtr{Diff,Add,Sub}()` that use these suppressions.
  The end goal is to only tag these functions with
  `ZSTD_ALLOW_POINTER_OVERFLOW`. But we can start by annoting functions
  that rely on pointer overflow, and gradually transition to using
  these.
* Add `ZSTD_maybeNullPtrAdd()` to simplify pointer addition when the
  pointer may be `NULL`.
* Fix all the fuzzer issues that came up. I'm sure there will be a lot
  more, but these are the ones that came up within a few minutes of
  running the fuzzers, and while running GitHub CI.
23 files changed:
Makefile
lib/common/compiler.h
lib/compress/zstd_compress_internal.h
lib/compress/zstd_double_fast.c
lib/compress/zstd_fast.c
lib/compress/zstd_lazy.c
lib/compress/zstd_ldm.c
lib/compress/zstd_opt.c
lib/decompress/huf_decompress.c
lib/decompress/zstd_decompress.c
lib/decompress/zstd_decompress_block.c
lib/legacy/zstd_legacy.h
lib/legacy/zstd_v01.c
lib/legacy/zstd_v02.c
lib/legacy/zstd_v03.c
lib/legacy/zstd_v04.c
lib/legacy/zstd_v05.c
lib/legacy/zstd_v06.c
lib/legacy/zstd_v07.c
tests/decodecorpus.c
tests/fuzz/fuzz.py
tests/fuzz/sequence_compression_api.c
tests/fuzzer.c