Skip to content

Fix for #85 and #86 - #87

Closed
twogood wants to merge 3 commits into
mainfrom
exceptions
Closed

twogood wants to merge 3 commits into
mainfrom
exceptions

Conversation

@twogood

@twogood twogood commented Oct 30, 2018 •

Copy link
Copy Markdown
Owner

Is longjmp() better than abort()?

See #85 and #86

Is longjmp() better than abort()?
@twogood twogood self-assigned this Oct 30, 2018
Is longjmp() better than abort()?
@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 31 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 189f6119-a2d9-4bd6-92e5-7d3d586e87d8
📥 Commits

Reviewing files that changed from the base of the PR and between 313534b and 5b195f6.

📒 Files selected for processing: 10
  • lib/component.c
  • lib/helper.c
  • lib/internal.h
  • lib/libunshield.c
  • test/bugs/debian-776238/data1.cab
  • test/bugs/debian-776238/data1.hdr
  • test/bugs/debian-776238/debian-776238.sh
  • test/bugs/debian-776239/data1.cab
  • test/bugs/debian-776239/data1.hdr
  • test/bugs/debian-776239/debian-776239.sh
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@twogood

twogood commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner Author

What this change does: Replaces an abort and adds an offset check using setjmp/longjmp. Returning an error for malformed cabinets is valuable.

Must fix: The new check adds two 32-bit offsets before comparing against the header size, so that addition can wrap. It also allows an offset exactly at the end of the buffer and does not check the number of bytes each caller will read.

I ran a standalone probe with a 16-byte header and descriptor offset 8: offset 8 was accepted as the one-past-end pointer; offset UINT32_MAX-7 was also accepted and returned a pointer 4 GiB beyond the buffer. Real callers immediately read fields from these pointers. This does not provide adequate bounds validation.

Use widened arithmetic and validate the entire requested range at each parser boundary. Prefer ordinary error returns for these targeted failures rather than adding nonlocal exception handling. The new shell fixtures are also not registered with CTest, so the passing existing suite (24/24) does not exercise them.

Verdict: Do not merge this old implementation. Keep the malformed-input error-handling goal, but replace it with focused validated fixes and integrated regression tests. #234 is a better example of a focused range check, though it covers a different parser boundary.


Branch update correction: The initial update used a force-pushed rebase. The original PR commits have now been restored as first-parent history with a merge commit, pushed normally without force. Both the original and previously rebased commits remain reachable. The reviewed file contents are unchanged.

Review basis: main 313534b (after #199), with current logging, assertions, I/O callbacks, and GCC 14/15 CI preserved in conflict resolutions. No functional fixes to the findings above were folded into the branch update. Local checks used macOS arm64, shared Debug builds with bundled MD5 unless stated otherwise; native MSVC and glibc runtime checks were not performed.

Restore the original contribution commits as the first-parent history.
Keep the reviewed conflict resolutions and current main without rewriting published history again.
@twogood

twogood commented Oct 18, 2026

Copy link
Copy Markdown
Owner Author

Try to fix #44 in a better way.

@twogood twogood closed this Oct 18, 2026
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