Repository navigation
chore: update inih to 577ae2d and raise INI_MAX_LINE to 2048 - #24
Merged
Merged
Conversation
source/libs/inih/ini.{c,h} are replaced with upstream benhoyt/inih 577ae2d
(2026-01-30), byte for byte, so the next resync stays a two-file copy with no
patch to re-apply. INI_MAX_LINE moves from 1024 to 2048 in BUILD_FLAGS: a
pasted "Token=" is an OAuth access token and Google's run past a kilobyte.
The update fixes a misattributed error this project actually hits. Given a
token longer than the buffer, the old parser cut the line and parsed its tail
as the next line, so ParseError() named the line *after* the offending one --
debugConfigSummary() would report "syntax error on line 3, that line was
ignored" while pointing at a perfectly valid Path=. Upstream now discards the
overflow and reports the real line number.
Validated against the vendored copy rather than upstream's tree: all 15 of
upstream's test configurations match their baselines, and an old-vs-new diff
over a corpus of README-shaped configs (1.1 KB token, inline comments,
multiline continuations, BOM, CRLF, unterminated sections, over-long
section/key names, no trailing newline) shows only two changes, both
improvements -- the line numbering above, and inline comments now being
stripped from continuation lines.
One upstream quirk came out of the boundary probe and is left unpatched: a line
whose content is exactly INI_MAX_LINE-1 bytes and ends in a newline parses
completely, value intact, yet is still flagged as a syntax error. At 2048 that
needs a 2047-byte line, main() only bails on ParseError() < 0 so a sync still
runs, and the symptom is a debug-only message claiming a line was ignored when
it was not -- not worth breaking the byte-identical invariant for.
INI_HANDLER_LINENO still defaults to 0, keeping INIReader::ValueHandler's
four-argument form correct, and the renamed statics (rstrip -> ini_rstrip and
friends) were all file-local, so nothing outside ini.c referenced them.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces
source/libs/inih/ini.{c,h}with upstream benhoyt/inih577ae2d(2026-01-30), byte for byte, and raisesINI_MAX_LINEfrom 1024 to 2048 inBUILD_FLAGS. A pastedToken=is an OAuth access token and Google's run past a kilobyte.Keeping the two files identical to upstream means the next resync is a two-file copy with no patch to re-apply, so inih's compile-time options stay in the Makefile.
source/libs/inih/INIReader/is untouched — it is a local fork, andGetValues()(whichgetConfiguredSyncPaths()depends on) has no upstream equivalent.Why this update is worth taking
It fixes an error misattribution this project actually hits. Given a token longer than the buffer, the old parser cut the line and parsed its tail as the next line, so
ParseError()named the line after the offending one —debugConfigSummary()would reportsyntax error on line 3, that line was ignoredwhile pointing at a perfectly validPath=. Upstream now discards the overflow and reports the real line number.Validation
Everything below was run against the vendored copy, not upstream's tree.
.3dsx,.3ds,.cia, zip).ini.candINIReader.cppare also clean under devkitARM at-Wall -Wextra -Wpedantic.INI_HANDLER_LINENO=1, and the rest.AGENTS.md:INI_HANDLER_LINENOstill defaults to 0, soINIReader::ValueHandler's four-argument form is still correct;ini_parse/ini_parse_stringsignatures are unchanged apart from the no-opINI_API; the renamed statics (rstrip→ini_rstripand friends) were all file-local, so nothing outsideini.creferenced them.One upstream quirk, left unpatched
A line whose content is exactly
INI_MAX_LINE - 1bytes and ends in a newline parses completely, value intact, yet is still flagged as a syntax error. Reproduced standalone againstini.calone atINI_MAX_LINE=20, so it is upstream's off-by-one rather than a bad copy.At 2048 this needs a 2047-byte config line;
main()only bails onParseError() < 0so a sync still runs, and the symptom is a debug-only message claiming a line was ignored when it was not. Not worth breaking the byte-identical invariant for — better filed upstream.Notes, no action needed
The new
assert()s on NULL arguments are live (NDEBUGis unset,__assert_funclinks in) but unreachable throughINIReader—ini_parseonly calls through after a successfulfopen. And sinceINI_USE_STACK=1, the 1024 → 2048 bump grewini_parse_stream's frame to 2196 bytes; it is called frommain(), so there is ample stack.🤖 Generated with Claude Code
adresses #14