Skip to content

IntegerField maximum=2147483648 overflows to float on 32-bit/ARM PHP, crashes all REST API pages #917

Description

@NepoKama

Describe the bug

Every REST API admin page (System > REST API, its Settings/Keys/Documentation subpages) crashes the web server with an uncaught TypeError, on ARM hardware. Root cause: Models/LogSettings.inc hardcodes maximum: 2147483648 (2³¹) on the logfilesize IntegerField — one past the max value a 32-bit signed int can hold. On this platform, PHP's native int is apparently 32-bit, so PHP silently reinterprets that literal as a float at parse time, which then fails the constructor's strict int type check. Because LogSettings gets constructed during shared bootstrap (endpoint building, privilege caching, schema building), this one field takes down every REST API page, not just log settings.

This looks like the same class of bug previously reported in #502 (which also cited NumericRangeValidator.inc, FloatField.inc, IntegerField.inc, and UnixTimeField.inc), so there may be other oversized integer literals elsewhere with the same overflow risk on 32-bit platforms.

To Reproduce

Steps to reproduce the behavior:

  1. Install pfSense-pkg-RESTAPI on a 32-bit/ARM pfSense platform (e.g. a Netgate ARM appliance).
  2. Go to System > REST API.
  3. Web server crashes with a fatal error instead of loading the page.

Expected behavior

The REST API admin pages should load normally regardless of CPU architecture / native int size.

Screenshots or Response

PHP Fatal error:  Uncaught TypeError: RESTAPI\Fields\IntegerField::__construct(): Argument #16 ($maximum) must be of type int, float given, called in /usr/local/pkg/RESTAPI/Models/LogSettings.inc on line 123 and defined in /usr/local/pkg/RESTAPI/Fields/IntegerField.inc:86
Stack trace:
#0 /usr/local/pkg/RESTAPI/Models/LogSettings.inc(123): RESTAPI\Fields\IntegerField->__construct()
#1 /usr/local/pkg/RESTAPI/Core/Endpoint.inc(391): RESTAPI\Models\LogSettings->__construct()
#2 /usr/local/pkg/RESTAPI/Endpoints/StatusLogsSettingsEndpoint.inc(21): RESTAPI\Core\Endpoint->__construct()
#3 /usr/local/pkg/RESTAPI/.resources/scripts/manage.php(40): RESTAPI\Endpoints\StatusLogsSettingsEndpoint->__construct()
#4 /usr/local/pkg/RESTAPI/.resources/scripts/manage.php(485): build_endpoints()
#5 {main}
  thrown in /usr/local/pkg/RESTAPI/Fields/IntegerField.inc on line 86

Relevant source (Models/LogSettings.inc, ~line 123):

$this->logfilesize = new IntegerField(
    default: 512000,
    minimum: 100000,
    maximum: 2147483648,
    verbose_name: 'Log File Size',
    help_text: 'The maximum size of the log file in kilobytes.',
);

pfSense Version & Package Version:

  • pfSense Version: Plus 26.03.1-RELEASE (arm) — FreeBSD 16.0-CURRENT #13 plus-RELENG_26_03_1-n256546-1d1bfd578383
  • Package Version: 2.8_3 (installed via pfSense-26.03.1-pkg-RESTAPI.pkg)

Affected Endpoints:

  • URL: /system_restapi_settings.php and effectively all REST API admin pages (crash occurs during shared endpoint/privilege/schema bootstrap, not a single endpoint)

Additional context

Workaround: manually editing /usr/local/pkg/RESTAPI/Models/LogSettings.inc line 123 to maximum: 2147483647, (the actual 32-bit signed int max) resolves the crash, but is overwritten on the next package update. Suggested proper fix: use 2147483647 or PHP_INT_MAX, and audit other IntegerField/FloatField/NumericRangeValidator/UnixTimeField definitions for similarly oversized literal bounds that could hit the same PHP int/float coercion issue on 32-bit platforms.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions