Repository navigation
Fix integer a^b and luaA_strtol's endptr - #9
Conversation
luai_numpowimpl started from r = a, so a^b was a^(b+1), and a negative b looped about 2^32 times on the console. It now squares and multiplies; a negative exponent truncates to 0 unless |a| is 1. luaA_strtol returned early on a leading 0 in base 10 without setting endptr, which luaO_str2d then read, so 010 failed to compile. It now skips spaces and the sign before looking for a prefix, and sets endptr on every return, to nptr when no digit was read. tests/numbers.c checks both on the host and runs in CI. Fixes #8.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (5)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe integer power calculation and string-to-integer parser have changed. A standalone C test program checks both primitives, and the build workflow compiles and runs that program. The Lua sample adds an expression using integer power and an octal literal. ChangesInteger number primitives
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The number-primitive fixes and host checks are mergeable after normal checks; no actionable regression is established. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The changes remain within numeric primitives and automated checks, with no demonstrated new privilege or trust-boundary exposure. Corrected arithmetic changes computed constants; compatibility with separately maintained compilers and existing bytecode remains unverified. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 4 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
Fixes #8.
a^bcomputed a^(b+1), and a negative exponent looped about 2^32 times. Now it squares and multiplies; a negative exponent gives 0 unless |a| is 1.luaA_strtolreturned without settingendptron a leading 0 in base 10, so010failed to compile. Nowendptris always set, tonptrwhen no digit was read, and the sign is read before the0xprefix.tests/numbers.cchecks both on the host (16 failures on the old code) and runs in CI.tests/sample.luanow has2^10 + 010: the old luac.ps-exe gives "malformed number near '010'", the new one stores the constant 1034.Compiled bytecode changes for any script using
^on constants, so splashedit-ng's host compiler and fixtures need the same change.Summary by CodeRabbit