From 2cc020358d50d87612c00275eebebee7216997ab Mon Sep 17 00:00:00 2001
From: nkennedy <nkennedy@git.zephyr-software.com>
Date: Mon, 14 Oct 2013 19:03:46 +0000
Subject: [PATCH] fix underflow/buffer overrun bug. ok nkennedy@ ip:peasoup

Former-commit-id: d89cc386835ee6f1eedc45e7f9c5de5f066b1a7d
---
 libIRDB/test/find_strings.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libIRDB/test/find_strings.cpp b/libIRDB/test/find_strings.cpp
index 5f4da3f2c..a6fb7879d 100644
--- a/libIRDB/test/find_strings.cpp
+++ b/libIRDB/test/find_strings.cpp
@@ -394,12 +394,13 @@ void find_strings_in_data(FileIR_t* firp, elf_info_t& ei, pqxx::largeobjectacces
 {
 	for(int i=0;i<ei.secnum;i++)
 	{
-		/* skip executable, hash, string table, and nonloadable sections */
+		/* skip executable, hash, string table, nonloadable, and tiny sections */
 		if( (ei.sechdrs[i].sh_flags & SHF_EXECINSTR)
 		    || ei.sechdrs[i].sh_type == SHT_HASH
 		    || ei.sechdrs[i].sh_type == SHT_GNU_HASH
 		    || ei.sechdrs[i].sh_type == SHT_STRTAB
-		    || (ei.sechdrs[i].sh_flags & SHF_ALLOC) != SHF_ALLOC)
+		    || (ei.sechdrs[i].sh_flags & SHF_ALLOC) != SHF_ALLOC
+		    || ei.sechdrs[i].sh_size < sizeof(void*))
 			continue;
 
 		int offset = 0;
-- 
GitLab