Title: fix(files): bound the HEIF fallback decode input by waleedlatif1 · Pull Request #6348 · simstudioai/sim · GitHub
Open Graph Title: fix(files): bound the HEIF fallback decode input by waleedlatif1 · Pull Request #6348 · simstudioai/sim
X Title: fix(files): bound the HEIF fallback decode input by waleedlatif1 · Pull Request #6348 · simstudioai/sim
Description: Summary Follow-up to #6346, which merged before this commit landed on the branch — the HEIF decoder went out without an input bound. Nothing upstream capped what could reach the WebAssembly decoder: uploads allow 100MB (validation.ts:15) and prepareImageForVision runs sharp with limitInputPixels: false. A tenant-controlled file could therefore spend unbounded CPU and memory on a single-threaded decode during one copilot read. transcodeHeicToJpeg now refuses input above a 20MB ceiling and returns null, which the existing "[Image unavailable]" path already handles. 20MB leaves generous headroom over any phone photo — a 12MP iPhone HEIC runs 1-4MB. Scope — what this does and does not cover Bounds file size. A large HEIF no longer reaches the decoder at all. Does not bound pixel count. A small file declaring enormous dimensions is a separate vector. It stays bounded by libheif's own security limits during parse, which are demonstrably active: the sharp attempt on a real iPhone HEIC fails with libheif's Security limit exceeded before any decode happens. No timeout or cancellation on the decode itself; the byte ceiling is what bounds its duration. Raised by Greptile on #6346 and worth disagreeing with if 20MB or the pixel-vector reasoning looks wrong. Type of Change Bug fix Testing Added a test asserting input above the ceiling returns null without invoking the decoder. 19 tests, typecheck clean. Checklist Code follows project style guidelines Self-reviewed my changes Tests added/updated and passing No new warnings introduced I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)
Open Graph Description: Summary Follow-up to #6346, which merged before this commit landed on the branch — the HEIF decoder went out without an input bound. Nothing upstream capped what could reach the WebAssembly decoder...
X Description: Summary Follow-up to #6346, which merged before this commit landed on the branch — the HEIF decoder went out without an input bound. Nothing upstream capped what could reach the WebAssembly decoder...
Opengraph URL: https://github.com/simstudioai/sim/pull/6348
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:048b48a4-2d22-294d-a3e6-62e9741719b5 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | AB2A:71943:93651C:CFD503:6AFB507E |
| html-safe-nonce | 8d072b10fd36e81c7cc8d98420f0381a6e828d0cce5a95c312df1b01ae84d42a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQjJBOjcxOTQzOjkzNjUxQzpDRkQ1MDM6NkFGQjUwN0UiLCJ2aXNpdG9yX2lkIjoiNzE0NzQ5NDI0ODYxNzMwMDA5NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 6c0d08a71e2cde2a47d96919dcf32733a61f370f88ccbb958b6affe771512a4a |
| hovercard-subject-tag | pull_request:4224345067 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/simstudioai/sim/pull/6348/files |
| twitter:image | https://avatars.githubusercontent.com/u/40672544?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/40672544?s=400&v=4 |
| og:image:alt | Summary Follow-up to #6346, which merged before this commit landed on the branch — the HEIF decoder went out without an input bound. Nothing upstream capped what could reach the WebAssembly decoder... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7122bb414b542dba14d71a3f0b9f6fd2abce715b9f5912d082800563e6c806d1 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/simstudioai/sim git https://github.com/simstudioai/sim.git |
| octolytics-dimension-user_id | 199344406 |
| octolytics-dimension-user_login | simstudioai |
| octolytics-dimension-repository_id | 912559512 |
| octolytics-dimension-repository_nwo | simstudioai/sim |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 912559512 |
| octolytics-dimension-repository_network_root_nwo | simstudioai/sim |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | cbf66c024bb6d10e6955baa7413c54cf13a201bb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width