Skip to content

Commit 1d8ddeb

Browse files
dfa1claude
andcommitted
fix(reader): validate segment specs in the HTTP reader
VortexHttpReader.open called PostscriptParser.parseBlobs directly, skipping the validateSegmentSpecs containment check that the local-file path runs inside PostscriptParser.parse. A malformed remote footer could therefore carry segmentSpecs whose offset/length fall outside the file, which rawSegment() would turn into out-of-bounds Range requests. Validate against fileSize before constructing the reader. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 428026d commit 1d8ddeb

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

reader/src/main/java/io/github/dfa1/vortex/reader/VortexHttpReader.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ public static VortexHttpReader open(URI uri, ReadRegistry registry, HttpClient c
124124
: null;
125125

126126
var parsed = PostscriptParser.parseBlobs(footerBuf, layoutBuf, dtypeBuf);
127+
// Reject footer segmentSpecs that fall outside the file before any rawSegment() builds a
128+
// Range request from them. The local-file path runs this inside PostscriptParser.parse;
129+
// the HTTP path calls parseBlobs directly and must validate here too.
130+
PostscriptParser.validateSegmentSpecs(parsed.footer().segmentSpecs(), fileSize);
127131

128132
return new VortexHttpReader(
129133
uri, client, fileSize, trailer.version(),

0 commit comments

Comments
 (0)