From 52d447c3f6653e1301f16fee1582f87437b6144d Mon Sep 17 00:00:00 2001
From: Erwan Jahier <erwan.jahier@univ-grenoble-alpes.fr>
Date: Thu, 22 Jun 2017 09:56:38 +0200
Subject: [PATCH] Make sure an int string is not an ident before trying a
 big_int convertion

---
 _oasis               |  2 +-
 doc/version.tex      |  6 +++---
 src/META             |  4 ++--
 src/localGenlex.ml   | 22 +++++++++++++---------
 src/lutilsVersion.ml |  4 ++--
 5 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/_oasis b/_oasis
index bf1efb4..44ae59d 100644
--- a/_oasis
+++ b/_oasis
@@ -1,6 +1,6 @@
 OASISFormat: 0.4
 Name:        lutils
-Version:     1.13
+Version:     1.14
 Authors:     Erwan Jahier
 Maintainers: erwan.jahier@imag.fr
 License:     GPL-3
diff --git a/doc/version.tex b/doc/version.tex
index ec5f35f..76b4ce5 100644
--- a/doc/version.tex
+++ b/doc/version.tex
@@ -1,4 +1,4 @@
-\newcommand{\version}{1.13}
-\newcommand{\sha}{0013635}
+\newcommand{\version}{1.14}
+\newcommand{\sha}{e9db055}
 \newcommand{\versionname}{none}
-\newcommand{\versiondate}{12-06-17}
+\newcommand{\versiondate}{22-06-17}
diff --git a/src/META b/src/META
index 462d0c0..5e2f56d 100644
--- a/src/META
+++ b/src/META
@@ -1,6 +1,6 @@
 # OASIS_START
-# DO NOT EDIT (digest: 15d9e918ed9eb34ce3e848dd1e1775a7)
-version = "1.13"
+# DO NOT EDIT (digest: bd2a3dd8b4c274b4d60cc3825abe018b)
+version = "1.14"
 description = "shared by Verimag/synchronous tools (lustre, lutin, rdbg)."
 requires = "unix str camlp4 num"
 archive(byte) = "lutils.cma"
diff --git a/src/localGenlex.ml b/src/localGenlex.ml
index bc60fc3..444dc40 100644
--- a/src/localGenlex.ml
+++ b/src/localGenlex.ml
@@ -27,15 +27,19 @@ let big_max_int = Big_int.big_int_of_nativeint Nativeint.max_int
 let local_int_of_string str = 
   try int_of_string str
   with _ ->
-    let big_i0 = Big_int.big_int_of_string str in
-    let big_i = Big_int.mod_big_int big_i0 (Big_int.succ_big_int big_max_int) in
-    let i = Nativeint.to_int (Big_int.nativeint_of_big_int big_i) in
-    if (Big_int.big_int_of_int i <> big_i0) then (
-      Printf.eprintf  "Warning: integer overflow (%s truncated to %s)\n" 
-        (Big_int.string_of_big_int big_i0) (string_of_int i);
-      flush stderr
-    );
-    i
+       if Str.string_match (Str.regexp "[a-z]") str 0
+       then failwith ("Cannot convert "^str^" into an int")
+       else
+         let big_i0 = Big_int.big_int_of_string str in
+         let big_i = Big_int.mod_big_int big_i0 (Big_int.succ_big_int big_max_int) in
+         let i = Nativeint.to_int (Big_int.nativeint_of_big_int big_i) in
+         if (Big_int.big_int_of_int i <> big_i0) then (
+           Printf.eprintf  "Warning: integer overflow (%s truncated to %s)\n" 
+                           (Big_int.string_of_big_int big_i0) (string_of_int i);
+           flush stderr
+         );
+         i
+      
 
 
 
diff --git a/src/lutilsVersion.ml b/src/lutilsVersion.ml
index 7ad3273..0c749de 100644
--- a/src/lutilsVersion.ml
+++ b/src/lutilsVersion.ml
@@ -1,2 +1,2 @@
-let str="1.13"
-let sha="0013635"
+let str="1.14"
+let sha="e9db055"
-- 
GitLab