aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io/write.c
diff options
context:
space:
mode:
authorFrancois-Xavier Coudert <fxcoudert@gcc.gnu.org>2015-09-12 12:05:44 +0000
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>2015-09-12 12:05:44 +0000
commit76b88c5fc9930734f4d3496b9100862f62311ce5 (patch)
tree178a900d2d4f9108057640a6f3190da9cedbade1 /libgfortran/io/write.c
parent4e9da1551b2fea579e3e96b7fb80b32e101c268d (diff)
downloadgcc-76b88c5fc9930734f4d3496b9100862f62311ce5.zip
gcc-76b88c5fc9930734f4d3496b9100862f62311ce5.tar.gz
gcc-76b88c5fc9930734f4d3496b9100862f62311ce5.tar.bz2
re PR libfortran/67527 (io.h sanitizer complains on 1 << 31)
PR libfortran/67527 PR libfortran/67535 PR libfortran/67536 * io/io.h: Use unsigned values for 31-bit left shifts. * io/unix.c (buf_read): Do not call memcpy() with NULL pointer arg. * io/write.c (nml_write_obj): Likewise. From-SVN: r227705
Diffstat (limited to 'libgfortran/io/write.c')
-rw-r--r--libgfortran/io/write.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c
index e226236..6656c97 100644
--- a/libgfortran/io/write.c
+++ b/libgfortran/io/write.c
@@ -1833,7 +1833,8 @@ nml_write_obj (st_parameter_dt *dtp, namelist_info * obj, index_type offset,
+ strlen (obj->var_name) + obj->var_rank * NML_DIGITS + 1;
ext_name = xmalloc (ext_name_len);
- memcpy (ext_name, base_name, base_name_len);
+ if (base_name)
+ memcpy (ext_name, base_name, base_name_len);
clen = strlen (obj->var_name + base_var_name_len);
memcpy (ext_name + base_name_len,
obj->var_name + base_var_name_len, clen);