Conversation
MCP_TINY_IMAGE is served as image/png by the get-tiny-image tool, but its iCCP chunk is corrupt: the chunk records CRC-32 0x5321b951 while its contents hash to 0x9004394b, and the zlib stream inside it ends with an Adler-32 trailer of 0x5d040ba2 instead of 0x6f050bad. The stream therefore fails to inflate, with inflateSync reporting "incorrect data check", and a chunk whose CRC-32 does not match its contents is invalid per the PNG specification. The deflate payload itself is intact: once the Adler-32 is corrected it inflates to a well-formed 3348-byte ICC profile whose declared size matches and whose 17 tag tables all stay within the profile. Correct the two checksums rather than dropping the chunk; no other byte of the image changes. Adds vitest coverage that walks the chunk stream, checks every chunk's CRC-32 against the bytes it covers, and inflates the iCCP profile. Both cases fail against the previous blob and pass now.
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.
Description
MCP_TINY_IMAGE(src/everything/tools/get-tiny-image.ts:5) is the hard-coded PNG that theget-tiny-imagetool returns as animage/pngcontent block. ItsiCCPchunk carries two bad checksums, so the blob is not a valid PNG:0x5321b951, but the bytes it covers hash to0x9004394b;0x5d040ba2instead of0x6f050bad, so it fails to inflate —inflateSyncreportsError: incorrect data check.The PNG specification requires every chunk's CRC-32 to match its contents, so decoders that verify checksums reject the file and the embedded color profile cannot be read.
This PR corrects the two checksums. No other byte of the image changes: the deflate payload is byte-for-byte identical, and only the 4-byte Adler-32 trailer and the 4-byte chunk CRC-32 differ.
Server Details
get-tiny-image)Motivation and Context
Root cause: the embedded PNG was committed with an incorrect Adler-32 trailer inside its
iCCPzlib stream and a consequently incorrect chunk CRC-32 (src/everything/tools/get-tiny-image.ts:6).The compressed payload is intact, so correcting rather than dropping the chunk preserves the image exactly. Inflating the payload yields a well-formed 3348-byte ICC profile: the declared size field matches the actual length, the tag count is 17, and every tag table lies within the profile (
appl, version 2.1, classmntr, color spaceRGB).How Has This Been Tested?
New test
src/everything/__tests__/get-tiny-image.test.tswalks the PNG chunk stream, recomputes each chunk's CRC-32 over the bytes it covers withnode:zlib'scrc32, and inflates theiCCPprofile.Against the current
mainblob, both cases fail:With the fix:
Existing suite and type check are unaffected:
Breaking Changes
None. The decoded image is unchanged — only its chunk checksums are corrected — so no client configuration or behavior needs updating.
Types of changes
Checklist
Additional context
The three unchecked boxes above that concern behavior rather than tooling are not applicable here: this change touches no server logic, no README content, no error paths, and no environment variables — it corrects two checksums in a static embedded asset, which is covered by the unit test above rather than by an LLM client run.
Verification of the checksum values was done independently of the test, with a separate PNG chunk parser: every chunk other than
iCCPalready had a correct CRC-32 (IHDR,eXIf,pHYs,iTXt,IDAT,IEND), and the correctediCCPtrailer equalsadler32()of the decompressed profile.The repo has no prettier config and
npm run prettier:checkalready fails on a cleanmaincheckout (59 files); CI runs onlynpm testandnpm run build. The edited source file is prettier-clean, and the new test follows the existing__tests__convention.