This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
fail gracefully on program without any loadable sections
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: libc-alpha at sources dot redhat dot com
- Date: 13 Mar 2003 22:01:26 -0300
- Subject: fail gracefully on program without any loadable sections
- Organization: GCC Team, Red Hat
If a program doesn't have any loadable sections, we crash in a
not-very-beautiful way. This gets us to reject the binary in a more
graceful manner. Ok to install?
Index: ChangeLog
from Alexandre Oliva <aoliva at redhat dot com>
* elf/dl-load.c: Lose if there are no loadable sections.
Index: elf/dl-load.c
===================================================================
RCS file: /cvs/glibc/libc/elf/dl-load.c,v
retrieving revision 1.220
diff -u -p -r1.220 dl-load.c
--- elf/dl-load.c 4 Mar 2003 00:08:51 -0000 1.220
+++ elf/dl-load.c 14 Mar 2003 01:00:15 -0000
@@ -1031,6 +1031,12 @@ cannot allocate TLS data structures for
/* Now process the load commands and map segments into memory. */
c = loadcmds;
+ if (nloadcmds == 0)
+ {
+ errstring = N_("no loadable sections");
+ goto call_lose;
+ }
+
/* Length of the sections to be loaded. */
maplength = loadcmds[nloadcmds - 1].allocend - c->mapstart;
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva at {redhat dot com, gcc.gnu.org}
CS PhD student at IC-Unicamp oliva at {lsd dot ic dot unicamp dot br, gnu.org}
Free Software Evangelist Professional serial bug killer