Unterminated string literals are accepted by SET, LOG, IF and ABORT

Open Beginner friendly
#25 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp
Domain
backend

Research direction

Start in src/script_lexer.cpp at the reported lexer lines, then inspect the SET, LOG, IF and ABORT parser call sites in src/script_parser.cpp to see how they handle token types. Run the reproductions from the issue and check that each unterminated string produces a parse error identifying the line; valid strings should continue to work.

Written by the indexing model from the issue text.

Description

bug
Summary

The lexer returns an UNKNOWN token for an unterminated string, but SET, LOG, IF operands and ABORT use tokens[n].value without checking the token type, so the script runs.

Location
  • File(s): src/script_lexer.cpp, src/script_parser.cpp
  • Line(s) / function(s): lexer L409–L410; parser call sites for SET/LOG/IF/ABORT
Category

error-handling

Severity

low

Typos produce running scripts with unexpected values instead of a parse error.

Reproduction / Evidence

Reproducible at runtime: SET $X "hello, LOG "unterminated and IF $X == "hello execute; ABORT "bye silently drops its message.

Expected Behavior

Parse error "unterminated string" at that line.

Actual Behavior

Accepted.

Root Cause

Token type not validated by those statement parsers.

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.