libelf: elf_strptr should fetch the shdr for the section if not yet known.

elf_strptr might be called before the shdrs are read in. In that case it
needs to explicitly call __elf[32|64]_getshdr_rdlock to check the section
type and size. The new strptr testcase triggers this corner case and crashes
before the fix.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 87a7ce7..f94d9be 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,12 @@
+2015-01-20  Mark Wielaard  <mjw@redhat.com>
+
+	* strptr.c: New file.
+	* run-strptr.sh: New test.
+	* Makefile.am (check_PROGRAMS): Add strptr.
+	(TESTS): Add run-strptr.sh.
+	(EXTRA_DIST): Likewise.
+	(strptr_LDADD): New variable.
+
 2015-01-15  Mark Wielaard  <mjw@redhat.com>
 
 	* deleted.c (main): Call prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY).