Numeric comparison and arithmetic are 32-bit int only and overflow

Open
#28 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
cpp
Domain
backend

Research direction

Start in src/script_executor.cpp at the comparison code around L666–L668 and the INC/DEC/ADD code around L337, L344, and L351; trace how each converts numeric values. Reproduce the reported cases and check the project’s existing tests before choosing how to represent and compare numbers. Done means decimal comparison works and the reported overflow cases no longer produce incorrect results or undefined behavior.

Written by the indexing model from the issue text.

Description

bug
Summary

The docs state numeric values compare numerically, but comparison and INC/DEC/ADD use toInt(): decimals and values above INT_MAX fall back to string comparison, and INC on INT_MAX overflows (signed-overflow UB).

Location
  • File(s): src/script_executor.cpp
  • Line(s) / function(s): comparison L666–L668; INC/DEC/ADD L337, L344, L351
Category

functional

Severity

low

Reproduction / Evidence

Reproducible at runtime: "9.5" < 10 is false; INC on 2147483647 gives -2147483648; SET $M 3000000000 / INC $M gives 1.

Expected Behavior

64-bit or decimal arithmetic with overflow detection; numeric comparison for decimals.

Actual Behavior

As above.

Root Cause

int conversions throughout.

Dominant language
C++
Stars
1
Forks
2
Avg merge
1h 34m
Merged PRs (30d)
7

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from 5250ng/5250script

All issues in 5250ng/5250script

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.