2022-09-26 15:56 BST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0002846NetSurf[All Projects] Generalpublic2022-09-11 14:23
ReporterPhilipRoman 
Assigned ToVincent Sanders 
SeveritycrashReproducibilityalways 
StatusresolvedResolutionopen 
Platformx86_64OSArtix LinuxOS Version
Product Version3.10 
Target Version3.11Fixed in Version3.11 
Summary0002846: Division by zero when there are images in cache but total size is zero.
DescriptionExactly what the title says.

I discovered this while trying to use man -H without psutils installed, which produced empty images. The bug is relatively harmless and almost impossible to come across in a real-life scenario but since netsurf works with untrusted input I thought it would be a good idea to patch it.
Steps To Reproducerun commands:
  touch empty.png
  echo '<img src="empty.png">' > test.html
  netsurf test.html
close browser
netsurf dumps core due to SIGFPE
Additional InformationSource file: content/handlers/image/image_cache.c
Function: image_cache_fini

op_size is zero but op_count is not:


if (op_count > 0) {
    ...
    NSLOG(netsurf, INFO,
      "Cache total/hit/miss/fail (size) ...",
      ...
      (image_cache->hit_size * 100) / op_size,
TagsNo tags attached.
Fixed in CI build #5364
Reported in CI build #
URL of problem page
Attached Files

-Relationships
+Relationships

-Notes
Vincent Sanders

~0002406

Vincent Sanders (administrator)

ensured the logging did not attempt a divide by zero in this case
+Notes

-Issue History
Date Modified Username Field Change
2022-04-04 14:13 PhilipRoman New Issue
2022-09-11 14:23 Vincent Sanders Assigned To => Vincent Sanders
2022-09-11 14:23 Vincent Sanders Status new => resolved
2022-09-11 14:23 Vincent Sanders Fixed in Version => 3.11
2022-09-11 14:23 Vincent Sanders Target Version => 3.11
2022-09-11 14:23 Vincent Sanders Fixed in CI build # => 5364
2022-09-11 14:23 Vincent Sanders Note Added: 0002406
+Issue History