Skip to content

upsimage.cgi: adjust scaling for small ranges (single-digit)#3496

Merged
jimklimov merged 1 commit into
networkupstools:masterfrom
jimklimov:issue-3469
Jun 28, 2026
Merged

upsimage.cgi: adjust scaling for small ranges (single-digit)#3496
jimklimov merged 1 commit into
networkupstools:masterfrom
jimklimov:issue-3469

Conversation

@jimklimov

Copy link
Copy Markdown
Member

Closes: #3469

Avoid lack of output when the range of a variable is small (e.g. 0-10) and division by zero occurred instead.

Practical testing needed (not done so far).

@jimklimov jimklimov added this to the 2.8.6 milestone Jun 22, 2026
@jimklimov jimklimov added bug CGI impacts-release-2.8.5 Issues reported against NUT release 2.8.5 (maybe vanilla or with minor packaging tweaks) labels Jun 22, 2026
@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown

A ZIP file with standard source tarball and another tarball with pre-built docs for commit 73fa2f4 is temporarily available: NUT-tarballs-PR-3496.zip.

@AppVeyorBot

Copy link
Copy Markdown

Build nut 2.8.5.4852-master completed (commit 3471d3f670 by @jimklimov)

…single-digit) ranges [networkupstools#3469]

Avoid lack of output when the range of a variable is small (e.g. 0-10)
and division by zero occurred instead.

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@AppVeyorBot

Copy link
Copy Markdown

Build nut 2.8.5.4854-master completed (commit 6f7ae47734 by @jimklimov)

@AppVeyorBot

Copy link
Copy Markdown

@mfrakka

mfrakka commented Jun 28, 2026

Copy link
Copy Markdown

Tested on: Arch Linux, NUT 2.8.5, nutdrv_qx Q1, VulTech GS-3KVAS-RK (device reports battery.voltage as single 2 V cell)
Test command:
QUERY_STRING='host=vultech-3kva@192.168.150.1&display=battery.voltage&width=90' ./upsimage.cgi > out.png
echo "exit=$?" && xxd out.png | head -4

Result with stock 2.8.5: exit=136 (SIGFPE), empty output, Apache logs End of script output before headers.
Result with PR #3496 patch: exit=0, 798-byte output starting with Pragma: no-cache / Content-type: image/png followed by valid PNG signature (89 50 4e 47). Image renders correctly in browser.

Patch confirmed working. ✅

@jimklimov
jimklimov merged commit 6268974 into networkupstools:master Jun 28, 2026
112 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug CGI impacts-release-2.8.5 Issues reported against NUT release 2.8.5 (maybe vanilla or with minor packaging tweaks)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

# upsimage.cgi crashes with SIGFPE (division by zero) on small per-cell battery.voltage values

3 participants