Fix signedness warning in data section size check (fixes #486) - #487
Conversation
src/maxminddb.c:370:27: error: comparison of integer expressions of different signedness: ‘ssize_t’ {aka ‘int’} and ‘unsigned int’ [-Werror=sign-compare]
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe change reorders two validation operands in ChangesMetadata validation
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~2 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to This change only reorders equivalent validation checks and carries no identified merge risk. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. A rabbit checks the size with care Comment |
|
Thank you! |
ssize_t and long are 32 bits wide on i686. That exposes signedness and range problems that the 64-bit jobs cannot see, such as the -Wsign-compare error fixed in #487, which only showed up in Fedora's i686 build. The new job builds and tests with -m32 using gcc and clang. The flags are set for the whole job so that the libtap build, which has its own Makefile, and the test scripts that compile code themselves pick them up. The decoder limits test kept only -f flags from the environment when it rebuilt the library, so it would have dropped -m32 and checked 64-bit code. It now keeps -m flags as well. With the #487 fix reverted, the old script passed at 32-bit and the new one fails with the original error. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Add changelog entry for #487 and fix a comment typo
The fix in maxmind#487 resolved a build failure for packagers on platforms where ssize_t is 32 bits, such as i686, where -Werror turns the -Wsign-compare warning into an error. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Fix a
-Wsign-comparewarning in the data section size check:data_section_sizeis assize_t, whileUINT32_MAXis unsigned. The check is adjusted to avoid the signed/unsigned comparison. For consistency, the <= 0 check is performed first so the value is known to be positive before converting it touint64_t.Summary by CodeRabbit