Skip to content

fix: replace unsafe transmute with Request::from_ngx_http_request#15

Merged
RyanKung merged 1 commit into
masterfrom
test/reproduce-empty-response-options
Dec 1, 2025
Merged

fix: replace unsafe transmute with Request::from_ngx_http_request#15
RyanKung merged 1 commit into
masterfrom
test/reproduce-empty-response-options

Conversation

@RyanKung

@RyanKung RyanKung commented Dec 1, 2025

Copy link
Copy Markdown
Contributor

This fixes a critical memory safety issue that caused SIGSEGV crashes when processing OPTIONS requests. The issue was caused by unsafe mem::transmute assuming identical memory layouts between ngx_http_request_t and ngx::http::Request, which can break across different Nginx versions or compiler settings.

Changes:

  • Replace mem::transmute with ngx-rust official API Request::from_ngx_http_request
  • Add null pointer checks before creating Request objects
  • Remove unnecessary unsafe keywords
  • Clean up temporary debugging scripts and test files
  • Update test configurations to match production environment
  • Bump version to 1.3.2

Fixes memory corruption in ngx_http_update_location_config when processing CORS preflight OPTIONS requests.

This fixes a critical memory safety issue that caused SIGSEGV crashes
when processing OPTIONS requests. The issue was caused by unsafe
mem::transmute assuming identical memory layouts between ngx_http_request_t
and ngx::http::Request, which can break across different Nginx versions
or compiler settings.

Changes:
- Replace mem::transmute with ngx-rust official API Request::from_ngx_http_request
- Add null pointer checks before creating Request objects
- Remove unnecessary unsafe keywords
- Clean up temporary debugging scripts and test files
- Update test configurations to match production environment
- Bump version to 1.3.2

Fixes memory corruption in ngx_http_update_location_config when processing
CORS preflight OPTIONS requests.
@RyanKung RyanKung merged commit 096898a into master Dec 1, 2025
7 checks passed
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