-2015-10-11 Akihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>
+2016-10-26 Mark Wielaard <mjw@redhat.com>
+
+ * elf_begin.c (read_file): Always set maxsize when parent == NULL.
+
+2016-10-11 Akihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>
* elf_getarsym.c (elf_getarsym): Open code rawmemchr when not
available.
(validate_str): New function.
(elf_strptr): Use validate_str instead of memrchr.
-2015-10-11 Akihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>
+2016-10-11 Akihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>
* elf32_updatefile.c: Remove sys/param.h include.
* elf32_updatenull.c: Likewise. Add system.h include.
/* Create descriptor for processing file.
- Copyright (C) 1998-2010, 2012, 2014, 2015 Red Hat, Inc.
+ Copyright (C) 1998-2010, 2012, 2014, 2015, 2016 Red Hat, Inc.
This file is part of elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 1998.
|| cmd == ELF_C_WRITE_MMAP
|| cmd == ELF_C_READ_MMAP_PRIVATE);
+ if (parent == NULL)
+ {
+ if (maxsize == ~((size_t) 0))
+ {
+ /* We don't know in the moment how large the file is.
+ Determine it now. */
+ struct stat st;
+
+ if (fstat (fildes, &st) == 0
+ && (sizeof (size_t) >= sizeof (st.st_size)
+ || st.st_size <= ~((size_t) 0)))
+ maxsize = (size_t) st.st_size;
+ }
+ }
+ else
+ {
+ /* The parent is already loaded. Use it. */
+ assert (maxsize != ~((size_t) 0));
+ }
+
if (use_mmap)
{
if (parent == NULL)
{
- if (maxsize == ~((size_t) 0))
- {
- /* We don't know in the moment how large the file is.
- Determine it now. */
- struct stat st;
-
- if (fstat (fildes, &st) == 0
- && (sizeof (size_t) >= sizeof (st.st_size)
- || st.st_size <= ~((size_t) 0)))
- maxsize = (size_t) st.st_size;
- }
-
/* We try to map the file ourself. */
map_address = mmap (NULL, maxsize, (cmd == ELF_C_READ_MMAP
? PROT_READ
}
else
{
- /* The parent is already loaded. Use it. */
- assert (maxsize != ~((size_t) 0));
-
map_address = parent->map_address;
}
}