[eso-midas] 09/16: Fix off-by-one Fortran/C string problem

Ole Streicher olebole at moszumanska.debian.org
Wed Mar 25 14:16:07 UTC 2015


This is an automated email from the git hooks/post-receive script.

olebole pushed a commit to branch debian
in repository eso-midas.

commit 965e5c3127c2e83288662153dc7d13e175f32921
Author: Ole Streicher <debian at liska.ath.cx>
Date:   Wed Mar 25 13:49:02 2015 +0100

    Fix off-by-one Fortran/C string problem
---
 debian/patches/fix_ftoc.patch | 38 ++++++++++++++++++++++++++++++++++++++
 debian/patches/series         |  1 +
 2 files changed, 39 insertions(+)

diff --git a/debian/patches/fix_ftoc.patch b/debian/patches/fix_ftoc.patch
new file mode 100644
index 0000000..9f3d9e3
--- /dev/null
+++ b/debian/patches/fix_ftoc.patch
@@ -0,0 +1,38 @@
+Author: Ole Streicher <olebole at debian.org>
+Description: Fix off-by-one Fortran/C string problem
+ In Fortran, S2 is a constant-length string; it does *not* reserve an
+ additional byte for '\0'. Since the C routine wants to add a trailing '\0',
+ we need to increase the length by one.
+ .
+ This fixes the following address sanitizer error:
+ .
+  ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffb5cf5151 at pc 0x402824 bp 0x7fff
+  WRITE of size 1 at 0x7fffb5cf5151 thread T0
+    #0 0x402823 in ttt2_ system/good-ftoc/ftoc_generic.c:268
+    #1 0x401b27 in fgenec system/good-ftoc/for_generic.f:44
+    #2 0x400e31 in main system/good-ftoc/for_generic.f:75
+    #3 0x7f126c177b44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b44)
+    #4 0x400ea2 (system/exec/ftoc_generic.exe+0x400ea2)
+ .
+  Address 0x7fffb5cf5151 is located in stack of thread T0 at offset 513 in frame
+    #0 0x400f8f in fgenec system/good-ftoc/for_generic.f:1
+ .
+  This frame has 6 object(s):
+    [32, 36) 'ff'
+    [96, 100) 'ls1'
+    [160, 164) 'ls2'
+    [224, 228) 'numb'
+    [288, 297) 's1'
+    [352, 513) 's2' <== Memory access at offset 513 overflows this variable
+
+--- a/system/ftoc-new/for_generic.for
++++ b/system/ftoc-new/for_generic.for
+@@ -49,7 +49,7 @@
+ C 
+       INTEGER    NUMB, LS1, LS2, MADRID(3)
+ C 
+-      CHARACTER*161 S2
++      CHARACTER*162 S2
+       CHARACTER*9   S1
+ C 
+       REAL    FF
diff --git a/debian/patches/series b/debian/patches/series
index c781176..7aebf40 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -22,3 +22,4 @@ fix_filepath_c.patch
 fix_mutil_h.patch
 fix_scc_c.patch
 fix_cextrco_c.patch
+fix_ftoc.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-astro/packages/eso-midas.git



More information about the debian-science-commits mailing list