Repository navigation
v3.1.1: fix result writer overflow (GHSA-4qp2-3768-j99g) and other v3.1.0 defects - #39
Merged
Merged
Conversation
Merge main into develop after v3.1.0
writerecsmodule.c is rewritten with the same output for ordinary values (pinned by golden files captured from v3.1.0): - Hold column names, units, descriptions and string values in memory sized to them, and bound every formatted write; check data dictionary formats before use. - Write integers at full 64-bit width (exactly, when larger), keeping the flags of IPAC integer formats. - VOTable: datatype "long" for longlong and "int" for integer; escape FIELD attributes; split "]]>" inside CDATA; replace control characters XML does not allow. - CSV: double quotes inside values (RFC 4180). - JSON: escape keys and all control characters. Also: - writeresult.py: close the document when the row count is a multiple of the fetch size (VOTable lacked </VOTABLE>, JSON lacked ']'). - tapquery.py: pass the spatial index level to ADQL as an int, so command-line CONTAINS queries work. - tap.py: silence bs4's XMLParsedAsHTMLWarning when reading UWS job documents, which logged on every job request. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Outside IPAC, the format kept from the '.' on was copied out of the full format through a second buffer; gcc 12 -Wformat-truncation flagged the copy. Build it from the parsed precision instead. Output is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Fix for GHSA-4qp2-3768-j99g, plus the other defects reported privately against v3.1.0. Developed in the advisory's private fork, where Actions does not run; the CI job was reproduced by hand: the same install, ruff and pytest steps in
python:3.9–3.12-bookwormcontainers on linux/amd64 (gcc 12). All pass (340 passed, 2 skipped; 339/3 on 3.9, where one existing test needs 3.10), with no compiler warnings under-Wall -Wextra. Also tested on macOS, Python 3.11.Changes
TAP/writerecsmodule.c(rewritten)datatype="long"forlonglong(andbigint),"int"forinteger.]]>split inside CDATA, control characters XML forbids replaced with U+FFFD; JSON keys and all control characters escaped.TAP/writeresult.py: results whose row count is an exact multiple of the fetch size (10,000) were left unclosed (no</VOTABLE>, no JSON]). Now closed by a final tail-only writer call; JSON row separators are written before each row so that call leaves valid JSON.TAP/tapquery.py(item 5): the spatial index level is passed to ADQL as an int, so command-line CONTAINS queries work.TAP/tap.py(item 6): UWS job documents are read through_parse_uws(), which silences bs4'sXMLParsedAsHTMLWarning(logged on every job request). The HTML builder is kept, so tag look-ups are unchanged.Testing
tests/writerecs_cases.py+tests/fixtures/writerecs_golden/: output for ordinary values captured from the v3.1.0 module; the rewrite reproduces all 25 files byte for byte, plus v3.1.0's IPAC width-overflow messages.tests/test_writerecs.py,tests/test_v311_fixes.py: one or more tests per item; each fails on v3.1.0 and passes here. Long-input tests run in a child process so an overrun fails the test instead of crashing pytest.Before release
setup.py,TAP/tap.pydebug line,Sphinx/conf.py)Items 7–10 (ADQL and SpatialIndex packages) are not addressed here.
🤖 Generated with Claude Code