Skip to content

Avoid adding an offset to NULL - #33

Merged
inikep merged 1 commit into
inikep:lizardfrom
sorbet:sorbet
Jan 23, 2025
Merged

inikep merged 1 commit into
inikep:lizardfrom
sorbet:sorbet

Conversation

@elliottt

@elliottt elliottt commented Feb 3, 2021

Copy link
Copy Markdown

On https://github.com/sorbet/sorbet we were seeing ubsan errors with lizard in CI after upgrading to clang-10.0.0.

[2021-02-03T18:47:17Z] ==================== Test output for //main/lsp:error_reporter_test:
[2021-02-03T18:47:17Z] external/lizard/lib/lizard_decompress_lz4.h:30:56: runtime error: applying zero offset to null pointer
[2021-02-03T18:47:17Z]     #0 0x1f78c7e  (/usr/local/var/bazelcache/output-bases/test-static-sanitized/execroot/com_stripe_ruby_typer/bazel-out/k8-dbg/bin/main/lsp/error_reporter_test+0x1f78c7e)
[2021-02-03T18:47:17Z]     #1 0x1e1f75c  (/usr/local/var/bazelcache/output-bases/test-static-sanitized/execroot/com_stripe_ruby_typer/bazel-out/k8-dbg/bin/main/lsp/error_reporter_test+0x1e1f75c)
[2021-02-03T18:47:17Z]     #2 0x1e2b466  (/usr/local/var/bazelcache/output-bases/test-static-sanitized/execroot/com_stripe_ruby_typer/bazel-out/k8-dbg/bin/main/lsp/error_reporter_test+0x1e2b466)
[2021-02-03T18:47:17Z]     #3 0x1dc8375  (/usr/local/var/bazelcache/output-bases/test-static-sanitized/execroot/com_stripe_ruby_typer/bazel-out/k8-dbg/bin/main/lsp/error_reporter_test+0x1dc8375)
[2021-02-03T18:47:17Z]     #4 0x1402215  (/usr/local/var/bazelcache/output-bases/test-static-sanitized/execroot/com_stripe_ruby_typer/bazel-out/k8-dbg/bin/main/lsp/error_reporter_test+0x1402215)
[2021-02-03T18:47:17Z]     #5 0x13f8054  (/usr/local/var/bazelcache/output-bases/test-static-sanitized/execroot/com_stripe_ruby_typer/bazel-out/k8-dbg/bin/main/lsp/error_reporter_test+0x13f8054)
[2021-02-03T18:47:17Z]     #6 0x2661bac  (/usr/local/var/bazelcache/output-bases/test-static-sanitized/execroot/com_stripe_ruby_typer/bazel-out/k8-dbg/bin/main/lsp/error_reporter_test+0x2661bac)
[2021-02-03T18:47:17Z]     #7 0x2665ef8  (/usr/local/var/bazelcache/output-bases/test-static-sanitized/execroot/com_stripe_ruby_typer/bazel-out/k8-dbg/bin/main/lsp/error_reporter_test+0x2665ef8)
[2021-02-03T18:47:17Z]     #8 0x7fbfeeff6b96  (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
[2021-02-03T18:47:17Z]     #9 0x134fbd9  (/usr/local/var/bazelcache/output-bases/test-static-sanitized/execroot/com_stripe_ruby_typer/bazel-out/k8-dbg/bin/main/lsp/error_reporter_test+0x134fbd9)

The fix was to conditionally add the dictSize depending on whether dictStart was NULL.

This fixes a runtime error with ubsan in the sorbet codebase
@elliottt elliottt closed this Jun 1, 2022
@inikep inikep reopened this Jan 23, 2025
@inikep
inikep merged commit 9c0b80f into inikep:lizard Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants