Skip to content

Fix security and concurrency undefined behavior - #64

Open
mulugetam wants to merge 2 commits into
mainfrom
fix/ub-security-concurrency
Open

Fix security and concurrency undefined behavior#64
mulugetam wants to merge 2 commits into
mainfrom
fix/ub-security-concurrency

Conversation

@mulugetam

Copy link
Copy Markdown
Contributor
  • Validate the dest_size extracted from the gzip-ext header in DetectGzipExt(). Reject the header when dest_size + HDRFTR_SIZE would exceed the input buffer length, preventing an OOB read by QPL/QATzip on malformed or malicious input.

  • Change ShardedMap from storing unique_ptr to shared_ptr and return a shared_ptr copy from Get(). The caller now holds a refcounted handle that keeps the object alive for the duration of its use, eliminating use-after-free when a concurrent deflateEnd/inflateEnd or address-reuse scenario destroys the map entry.

  • Update ShardedMap tests to use shared_ptr accordingly.

- Validate the dest_size extracted from the gzip-ext header in
  DetectGzipExt(). Reject the header when dest_size + HDRFTR_SIZE
  would exceed the input buffer length, preventing an OOB read by
  QPL/QATzip on malformed or malicious input.

- Change ShardedMap from storing unique_ptr to shared_ptr and return
  a shared_ptr copy from Get(). The caller now holds a refcounted
  handle that keeps the object alive for the duration of its use,
  eliminating use-after-free when a concurrent deflateEnd/inflateEnd
  or address-reuse scenario destroys the map entry.

- Update ShardedMap tests to use shared_ptr accordingly.
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