Issue Bug Closed

#95419 Fileadmin upload larger than php memory limit results in excaused memory limit fatal error (e.g. a 2 GB Video File Upload)

Matthias Gläßner 09/30/21, 16:21 updated 06/27/24, 13:24

Description

Reproducing
1. Set PHP Memory Limit to e.g. 64 MB
2. Go to TYPO3 Backend -> Fileadmin
3. Upload a test file with a size of 2 GB (e.g. create it on MAC via `dd if=/dev/zero of=100m bs=1m count=2000` or use a video file) to a random existing fileadmin folder
4. The upload startet
5. After 100% upload status the upload throws an “internal server error” error (red loading bar with error text in it)
6. in PHP error log the resulting error is: `Allowed memory size of xyz bytes exhausted`

*Not yed tested in:
TYPO3 > v. 8.7 ELTS

*Explanation*
The reason for that is, that FilePersistenceSlot of sysext:form loads the whole content of the file via file_get_contents into a variable to create a checksum over the including content (getContentSignature() + searchAllowedInvocation()).

*Suggested Patch (works in TPYO3 v8.7 ELTS, not tested yet in TYPO3 v10/11/12)*
- See attached patch file
- The patch limits the content size for checksum creation, so that max 32 MB of file content is used for checksum creation.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.