Review 14.3 Merged

95872[BUGFIX] Avoid serving a partially written resized image

Benni Mack CR +2 V +2 Normal +95 −2 updated 09/16/26, 11:07

Commit message

GraphicalFunctions::resize() checks file_exists($output) and then
has the image processor write directly to that path, with no
temporary name and no rename(). Two concurrent requests resizing
the same not-yet-cached image can both see "missing" and both start
converting; a third request arriving in between sees
file_exists($output) === true while the file is still being
written, and can serve (or, with base64 embedding, read) a
truncated image - which can then be cached into the page cache
until the next flush.

combineExec(), used to compose masked images, has the identical
pattern: it writes its composed result straight to the public
output path with a direct shell command, with no temporary name
and no rename() either.

FAL's own processing was never exposed to this, since its output is
always moved into _processed_/ via rename() before a public URL is
handed out. A path that serves processed images directly from an
uncached frontend request - such as GifBuilder, or any future
processor writing straight to typo3temp/assets/images/ - is exposed
to it on every render, not just a backend queue.

Convert into a private temporary file first and rename() it onto
the public path only once conversion has finished, so
file_exists() is only ever true for a complete file, in both
methods. The target file extension is kept as the temporary name's
trailing extension, since the image processor infers the output
format from it.

Review

  • Code review CR +2 Done
    • Benni Mack +2
  • Verified V +2 Done
    • Benni Mack +2
    • core-ci +1 CI

Issues 1

Files 2

Review log 34

  1. Benni Mack commented on patch set 1 09/16/26, 10:25

    Cherry Picked from branch main.
  2. core-ci voted on patch set 1 V +1 09/16/26, 10:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/108671

  3. Benni Mack voted on patch set 1 CR +2 V +2 09/16/26, 11:07

  4. Benni Mack merged patch set 2 09/16/26, 11:07