I found a rather cryptic integer overflow when importing double
precision attributes into a dbf table: the values are recognized as
integer if there are no decimal places, e.g. 4294967296. The proposed
fix for trunk is

--->

Index: lib/db/sqlp/sqlp.l
===================================================================
--- lib/db/sqlp/sqlp.l  (revision 55660)
+++ lib/db/sqlp/sqlp.l  (working copy)
@@ -127,9 +127,19 @@
   ***************************************/
 %}
 [0-9]+  {
+                       double floatval;
+
                        yylval.intval = atoi(yytext);
                        /* yylval.strval = (char*)strdup(yytext); */
-                       return INTNUM;
+                       floatval = atof(yytext);
+                       if ((double)yylval.intval == floatval) {
+                           return INTNUM;
+                       }
+                       else {
+                           /* integer overflow */
+                           yylval.floatval = floatval;
+                           return FLOATNUM;
+                       }
              }
 %{
  /***************************************

<---

but I am not sure about side effects.

Markus M
_______________________________________________
grass-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-dev

Reply via email to