Bug 14519 - Incorrect sign of zero on strtod underflow
Summary: Incorrect sign of zero on strtod underflow
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.16
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-25 15:36 UTC by Joseph Myers
Modified: 2014-06-17 04:49 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Myers 2012-08-25 15:36:15 UTC
strtod sometimes returns positive zero on underflow when it should return negative zero.  Testcase:

#include <stdio.h>
#include <stdlib.h>

int
main (void)
{
  printf ("%a\n", atof ("-0x0.7p-1074"));
  return 0;
}

Testing a patch.
Comment 1 Joseph Myers 2012-08-27 16:14:10 UTC
Fixed for 2.17 by:

commit 7efb4737dd729326e5339facbd785cee43fb53b3
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Mon Aug 27 16:04:19 2012 +0000

    Fix sign of zero on strtod underflow (bug 14519).