Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#3912 closed Bug (fixed)

tr_torrentGetMetadataPercent() may return NaN

Reported by: simon Owned by: jordan
Priority: Normal Milestone: 2.20
Component: libtransmission Version: 2.11
Severity: Normal Keywords: backport-2.0x backport-2.1x
Cc:

Description

ret = (m->pieceCount - m->piecesNeededCount) / (double)m->pieceCount;

may evaluate to NaN (perhaps pieceCount is 0?), which results in the following invalid JSON breaking the web interface:

"metadataPercentComplete":nan

Adding a check to replace !isnormal(ret) with 0.0 fixes the JSON data.

Change History (3)

comment:1 Changed 11 years ago by jordan

  • Component changed from Transmission to libtransmission
  • Keywords backport-2.0x backport-2.1x added
  • Milestone changed from None Set to 2.20
  • Owner set to jordan
  • Status changed from new to assigned

comment:2 Changed 11 years ago by jordan

  • Resolution set to fixed
  • Status changed from assigned to closed

fixed in trunk by r11708.

comment:3 Changed 11 years ago by jordan

  • Summary changed from libtransmission/torrent-magnet.c tr_torrentGetMetadataPercent() may return NaN to tr_torrentGetMetadataPercent() may return NaN
Note: See TracTickets for help on using tickets.