Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

P2: A table missing its end tag hangs the game at startup with no message

Aperta
#7,912 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
47/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
cpp
Ambito
backend

Direzione di ricerca

Start with the loop in lighting_profiles.cpp:365 and the EOF behavior of stuff_string in parselo.cpp; the issue reports a reproducible hang using data/tables/test-ltp.tbm without #END PROFILES. Then inspect the similar loops in the nebula and list parsers mentioned in the report. Done means EOF no longer hangs startup and a release build reports a clear parse error for the missing terminator; only the lighting profile case was run.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Problem

A lighting profile table (lighting_profiles.tbl or a *-ltp.tbm) that ends without its #END PROFILES tag hangs the game at startup. The window never opens, one core sits at 100%, and nothing is written to the log, so the player has no idea which mod or which file is at fault. In a debug build the same file ends in a parse error dialog, which is the behavior a release build should also have.

The same shape exists in a few other table parsers that loop "until the end tag" and fall back to stuff_string or advance_to_eoln when a line is unknown: at end of file those calls do not advance, so the loop never ends. nebula.tbl missing its #end, and string or boolean lists missing their closing ) at end of file, behave the same way from reading the code. Only the lighting profile case was run.

Steps to reproduce

  1. FSO master 12a36dc1a (also current as of 76219fd1e; lighting_profiles.cpp and parselo.cpp are unchanged between them), release build, Linux, MediaVPs 5.0.2.
  2. Make a mod with one file, data/tables/test-ltp.tbm, containing exactly:
    #PROFILES
    $Profile: Test
    $Exposure: 4
    
    (no #END PROFILES line).
  3. Launch the game with that mod active.

Expected vs. actual behavior

Expected: the game starts, and either the profile loads with the missing tag tolerated, or a clear error names the file ("missing #END PROFILES in test-ltp.tbm").

Actual: the process never reaches the main hall. After two minutes it was still at 99.6% CPU with no log output. A debugger shows the main thread looping in lighting_profiles::profile::parse through optional_string and strncasecmp, called from parse_modular_table inside game_init. The loop at lighting_profiles.cpp:365 keeps asking for the end tag, finds nothing it recognizes, and the stuff_string(buffer, F_RAW) fallback at end of file reads an empty string without moving the parse pointer. The Warning() that would have named the line is compiled out of release builds.

Proposed fixes

  1. Stop the loop at end of file. In profile::parse (and the matching nebula and list loops), break when the parse pointer reaches the end of the text, then raise a parse error naming the missing tag. A few lines each, release-visible.
  2. Make the parser primitives refuse to stand still at EOF. Have advance_to_eoln and the raw-string path of stuff_string raise a parse exception when called with the pointer already at the terminating NUL. One change covers every "until end tag" loop in the tree, but it needs a check that no existing table relies on a trailing read at EOF being harmless.
  3. Add an EOF guard to optional_string_either / required_string_either. Return the "end" branch when no more text remains, so every loop written against those helpers terminates. Smaller blast radius than 2, but misses loops written against plain optional_string.
Lingua principale
C++
Stelle
488
Fork
184
Merge medio
2g 9h
PR unite (30g)
40

Preparare l'ambiente

Non abbiamo ancora controllato i file di configurazione di questo progetto. Parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di scp-fs2open/fs2open.github.com

Tutte le issue di scp-fs2open/fs2open.github.com

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.