System info page crashes when running on a 32-bit OS
Closed this issue · 0 comments
socram8888 commented
Server Software
(You can get all these stats from http://<your site>/system_info
)
- Shimmie version: 2.10.6
- Database: sqlite
- Web server: nginx + php-fpm
Client Software (please complete the following information)
- Device: irrelevant
- Browser: irrelevant
What steps trigger this bug
- Install on a 32-bit machine, such as a Raspberry Pi
- Click on system info
What did you expect to happen?
The system information is shown.
What actually happened?
A blank screen was presented, due to a integer overflow when calculating the total disk usage and total space.
Function get_info()
in /ext/et/main.php
casts the output of disk_total_space
and disk_free_space
to an integer. This integer is platform-dependant. In 32-bit machines like most embedded ARM devices or SBCs, this integer is 32-bit so it overflows when the disk is larger than 2GB.
This causes the application to crash when entering said page:
2024/02/16 16:25:02 [error] 425#425: *85 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught TypeError: Shimmie2\to_shorthand_int(): Argument #1 ($int) must be of type int, float given, called in /mnt/data/shimmie2/ext/et/main.php on line 108 and defined in /mnt/data/shimmie2/core/polyfills.php:491
Stack trace:
#0 /mnt/data/shimmie2/ext/et/main.php(108): Shimmie2\to_shorthand_int()
#1 /mnt/data/shimmie2/ext/et/main.php(21): Shimmie2\ET->get_info()
#2 /mnt/data/shimmie2/core/send_event.php(161): Shimmie2\ET->onPageRequest()
#3 /mnt/data/shimmie2/index.php(91): Shimmie2\send_event()
#4 {main}
thrown in /mnt/data/shimmie2/core/polyfills.php on line 491" while reading response header from upstream, client: 192.168.0.35, server: <ip>, request: "GET /shimmie/index.php?q=system_info HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "<ip>", referrer: "http://<ip>/shimmie/"