Opened 18 years ago

Closed 18 years ago

#1194 closed defect (fixed)

PlaybackBox::updateUsage() will crash with floating point exeception

Reported by: dag@… Owned by: Isaac Richards
Priority: minor Milestone: unknown
Component: mythtv Version:
Severity: medium Keywords:
Cc: Ticket locked: no

Description

PlaybackBox::updateUsage() in programs/mythfrontend/playbackbox.cpp will crash with a floatingpoint exception during two conditions:

  1. The total amount of space left is less than 1024 bytes
  2. The call to RemoteGetFreeSpace?() doesn't return any info (More likely than the previous in case of backend down for example)

The problem is line 940:

double perc = (double)((double)freeSpaceUsed / (double)freeSpaceTotal);

where freeSpaceTotal should be checked for 0 before usage.

I Would attach a patch, but as it will involve artistic decisions about what to report as usage and freeI think I leave that to the core team.

Change History (1)

comment:1 Changed 18 years ago by danielk

Resolution: fixed
Status: newclosed

(In [8844]) Fixes #1194. Check for zero before division.

Note: See TracTickets for help on using tickets.