Issue Task Resolved

#109741fix size calculation overflow for large inputs

TYPO3 GmbH TYPO3com 05/02/26, 07:12 updated 10/08/26, 10:05

Description

## Summary

Fix incorrect size calculation for large values in `GeneralUtility::getBytesFromSizeMeasurement()`.

—-

## Problem

Large inputs (e.g. `“1e20G”`) can overflow during float-based multiplication, producing incorrect integer results.

Example:

Input: `“1e20G”`
Before: `6396237370772946944` (incorrect)

—-

## Fix

Add a pre-multiplication overflow guard:

if ($bytes > intdiv(PHP_INT_MAX, MULTIPLIER)) {
return 0;
}

—-

## Impact

-No change for valid inputs
-Prevents incorrect values for extreme inputs

This issue was automatically created from https://github.com/TYPO3/typo3/pull/633

Reviews 2

History 26

  1. Anonymous commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-10-08T10:05:09+00:00" > 10/08/26, 10:05 </span>

    Applied in changeset commit:8cad522c2bb97b8d389587d531d40de985f464e1.