Changeset: 0ee596246c28 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/0ee596246c28
Modified Files:
        sql/server/sql_parser.y
Branch: Aug2024
Log Message:

Catch overflow.
Fixes #7572.


diffs (17 lines):

diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y
--- a/sql/server/sql_parser.y
+++ b/sql/server/sql_parser.y
@@ -6107,7 +6107,12 @@ intval:
                  // errno might be non-zero due to other people's code
                  errno = 0;
                  if (l <= 10) {
-                       $$ = strtol(s,&end,10);
+                       long v = strtol(s,&end,10);
+#if SIZEOF_LONG > SIZEOF_INT
+                       if (v > INT_MAX)
+                               errno = ERANGE;
+#endif
+                       $$ = (int) v;
                  } else {
                        $$ = 0;
                  }
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to