Bug 1230 - INF not accepted by strtod in Turkish locales (tr_TR.iso88599)
Summary: INF not accepted by strtod in Turkish locales (tr_TR.iso88599)
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.3.5
: P2 normal
Target Milestone: ---
Assignee: GOTO Masanori
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-22 22:28 UTC by Vincent Lefèvre
Modified: 2018-04-19 14:52 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 Vincent Lefèvre 2005-08-22 22:28:50 UTC
The ISO C standard requires "INF" to be accepted by strtod:

         -- one of INF or INFINITY, ignoring case

But in Turkish locales (LC_ALL=tr_TR.iso88599), where the lowercase 'I' is the
dotless 'i', "INF" (or similar) is not recognized as the infinity. This can be
seen with the following program and LC_ALL="tr_TR.iso88599". Tested under Debian
with the libc6 2.3.5-4 package.

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

int main (void)
{
  double x;
  char *end;
  int err;

  if (setlocale (LC_ALL, "") == NULL)
    {
      fprintf (stderr, "Can't set locales\n");
      exit (EXIT_FAILURE);
    }

  x = strtod ("INF", &end);
  err = *end != '\0';
  printf ("x = %f - error: %s\n", x, err ? "yes" : "no");

  return err;
}
Comment 1 Ulrich Drepper 2005-09-28 06:08:35 UTC
Fixed in the current CVS trunk version.