Fix three compiler warnings in RSA.xs#185
Draft
toddr-bot wants to merge 1 commit into
Draft
Conversation
1. extractBioString(): replace THROW+error with direct if+goto. The error variable was set by THROW but never read — the err handler unconditionally croaks via CHECK_OPEN_SSL(0). 2. rsa_crypt(): move the to_length<0 check into the pre-3.x #else block where to_length is int. On 3.x, to_length is size_t (unsigned), making the comparison always false (dead code) and triggering -Wtype-limits. 3. verify(): fix signed/unsigned comparison between EVP_PKEY_get_size() (int) and sig_length (STRLEN/size_t). Add explicit negative check before casting to STRLEN for the comparison. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
errorvariable inextractBioString()by replacing THROW with direct gototo_length < 0check into pre-3.x block (dead code on 3.x where to_length is size_t)verify()betweenEVP_PKEY_get_size()(int) and sig_length (STRLEN)Why
Building with
-Wall -Wextraproduces warnings that obscure real issues.These three are straightforward to fix without changing behavior:
-Wunused-but-set-variable:errorwas written by THROW but neverread — the err handler unconditionally croaks
-Wtype-limits:size_t < 0is always false-Wsign-compare: comparing signed int with unsigned STRLENFour remaining
-Wunused-but-set-variablewarnings from the THROW macroin 3.x-only functions (rsa_crypt, get_public_key_string, sign, verify)
are inherent to the macro pattern and left as-is.
Testing
make OPTIMIZE="-Wall -Wextra -Wno-unused-parameter":warnings reduced from 8 to 4
🤖 Generated with Claude Code