Skip to content

Fix null-pointer dereferences and partial-init failure - #65

Open
mulugetam wants to merge 1 commit into
mainfrom
fix/ub-null-safety
Open

Fix null-pointer dereferences and partial-init failure#65
mulugetam wants to merge 1 commit into
mainfrom
fix/ub-null-safety

Conversation

@mulugetam

Copy link
Copy Markdown
Contributor
  • LOAD_SYMBOL no longer returns early on failure. Instead it sets a global 'shim_disabled' flag and continues resolving all remaining symbols. This prevents null function-pointer calls when one symbol fails to load while others are still interposed.

  • Add null checks for pointers returned by ShardedMap::Get() in deflate(), inflate(), deflateSetDictionary(), gzwrite(), gzread(), gzclose(), gzeof(), GetDeflateExecutionPath(), and GetInflateExecutionPath(). When the pointer is null (e.g. stream opened via unintercepted gzopen64/deflateCopy, or shim disabled), fall through to the corresponding orig_* function.

- LOAD_SYMBOL no longer returns early on failure. Instead it sets a
  global 'shim_disabled' flag and continues resolving all remaining
  symbols. This prevents null function-pointer calls when one symbol
  fails to load while others are still interposed.

- Add null checks for pointers returned by ShardedMap::Get() in
  deflate(), inflate(), deflateSetDictionary(), gzwrite(), gzread(),
  gzclose(), gzeof(), GetDeflateExecutionPath(), and
  GetInflateExecutionPath(). When the pointer is null (e.g. stream
  opened via unintercepted gzopen64/deflateCopy, or shim disabled),
  fall through to the corresponding orig_* function.

Signed-off-by: Mulugeta Mammo <mulugeta.mammo@intel.com>
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.

1 participant