--- old/usr/src/cmd/sgs/elfdump/common/elfdump.c	2015-03-23 21:41:46.813527734 -0400
+++ new/usr/src/cmd/sgs/elfdump/common/elfdump.c	2015-03-23 21:41:46.830412501 -0400
@@ -551,7 +551,7 @@
 	Conv_dwarf_ehe_buf_t	dwarf_ehe_buf;
 	uint64_t		ndx, frame_ptr, fde_cnt, tabndx;
 	uint_t			vers, frame_ptr_enc, fde_cnt_enc, table_enc;
-	uint64_t		initloc, initloc0;
+	uint64_t		initloc, initloc0 = 0;
 	uint64_t		gotaddr = 0;
 	int			cnt;
 
@@ -563,6 +563,12 @@
 		}
 	}
 
+	if ((data == NULL) || (datasize == 0)) {
+		(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ),
+		    file, _cache ->c_name);
+		return;
+	}
+
 	/*
 	 * Is this a .eh_frame_hdr?
 	 */
@@ -587,8 +593,20 @@
 
 		dbg_print(0, MSG_ORIG(MSG_UNW_FRMVERS), vers);
 
-		frame_ptr = dwarf_ehe_extract(data, &ndx, frame_ptr_enc,
-		    ehdr->e_ident, B_TRUE, shdr->sh_addr, ndx, gotaddr);
+		switch (dwarf_ehe_extract(data, datasize, &ndx,
+		    &frame_ptr, frame_ptr_enc, ehdr->e_ident, B_TRUE,
+		    shdr->sh_addr, ndx, gotaddr)) {
+		case DW_OVERFLOW:
+			(void) fprintf(stderr, MSG_INTL(MSG_ERR_DWOVRFLW),
+			    file, _cache->c_name);
+			return;
+		case DW_BAD_ENCODING:
+			(void) fprintf(stderr, MSG_INTL(MSG_ERR_DWBADENC),
+			    file, _cache->c_name, frame_ptr_enc);
+			return;
+		case DW_SUCCESS:
+			break;
+		}
 		if (eh_state->hdr_cnt == 1) {
 			eh_state->hdr_ndx = shndx;
 			eh_state->frame_ptr = frame_ptr;
@@ -598,8 +616,20 @@
 		    conv_dwarf_ehe(frame_ptr_enc, &dwarf_ehe_buf),
 		    EC_XWORD(frame_ptr));
 
-		fde_cnt = dwarf_ehe_extract(data, &ndx, fde_cnt_enc,
-		    ehdr->e_ident, B_TRUE, shdr->sh_addr, ndx, gotaddr);
+		switch (dwarf_ehe_extract(data, datasize, &ndx, &fde_cnt,
+		    fde_cnt_enc, ehdr->e_ident, B_TRUE, shdr->sh_addr, ndx,
+		    gotaddr)) {
+		case DW_OVERFLOW:
+			(void) fprintf(stderr, MSG_INTL(MSG_ERR_DWOVRFLW),
+			    file, _cache->c_name);
+			return;
+		case DW_BAD_ENCODING:
+			(void) fprintf(stderr, MSG_INTL(MSG_ERR_DWBADENC),
+			    file, _cache->c_name, fde_cnt_enc);
+			return;
+		case DW_SUCCESS:
+			break;
+		}
 
 		dbg_print(0, MSG_ORIG(MSG_UNW_FDCNENC),
 		    conv_dwarf_ehe(fde_cnt_enc, &dwarf_ehe_buf),
@@ -610,18 +640,48 @@
 		dbg_print(0, MSG_ORIG(MSG_UNW_BINSRTAB2));
 
 		for (tabndx = 0; tabndx < fde_cnt; tabndx++) {
-			initloc = dwarf_ehe_extract(data, &ndx, table_enc,
-			    ehdr->e_ident, B_TRUE, shdr->sh_addr, ndx, gotaddr);
-			/*LINTED:E_VAR_USED_BEFORE_SET*/
+			uint64_t table;
+
+			switch (dwarf_ehe_extract(data, datasize, &ndx,
+			    &initloc, table_enc, ehdr->e_ident, B_TRUE,
+			    shdr->sh_addr, ndx, gotaddr)) {
+			case DW_OVERFLOW:
+				(void) fprintf(stderr,
+				    MSG_INTL(MSG_ERR_DWOVRFLW), file,
+				    _cache->c_name);
+				return;
+			case DW_BAD_ENCODING:
+				(void) fprintf(stderr,
+				    MSG_INTL(MSG_ERR_DWBADENC), file,
+				    _cache->c_name, table_enc);
+				return;
+			case DW_SUCCESS:
+				break;
+			}
 			if ((tabndx != 0) && (initloc0 > initloc))
 				(void) fprintf(stderr,
 				    MSG_INTL(MSG_ERR_BADSORT), file,
 				    _cache->c_name, EC_WORD(tabndx));
+			switch (dwarf_ehe_extract(data, datasize, &ndx, &table,
+			    table_enc, ehdr->e_ident, B_TRUE, shdr->sh_addr,
+			    ndx, gotaddr)) {
+			case DW_OVERFLOW:
+				(void) fprintf(stderr,
+				    MSG_INTL(MSG_ERR_DWOVRFLW), file,
+				    _cache->c_name);
+				return;
+			case DW_BAD_ENCODING:
+				(void) fprintf(stderr,
+				    MSG_INTL(MSG_ERR_DWBADENC), file,
+				    _cache->c_name, table_enc);
+				return;
+			case DW_SUCCESS:
+				break;
+			}
+
 			dbg_print(0, MSG_ORIG(MSG_UNW_BINSRTABENT),
 			    EC_XWORD(initloc),
-			    EC_XWORD(dwarf_ehe_extract(data, &ndx,
-			    table_enc, ehdr->e_ident, B_TRUE, shdr->sh_addr,
-			    ndx, gotaddr)));
+			    EC_XWORD(table));
 			initloc0 = initloc;
 		}
 	} else {		/* Display the .eh_frame section */
@@ -637,8 +697,8 @@
 			    file, EC_WORD(shndx), _cache->c_name,
 			    conv_ehdr_type(osabi, ehdr->e_type, 0, &inv_buf));
 		}
-		dump_eh_frame(data, datasize, shdr->sh_addr,
-		    ehdr->e_machine, ehdr->e_ident, gotaddr);
+		dump_eh_frame(file, _cache->c_name, data, datasize,
+		    shdr->sh_addr, ehdr->e_machine, ehdr->e_ident, gotaddr);
 	}
 
 	/*
@@ -736,7 +796,7 @@
 	exception_range_entry	scratch, *ent, *cur_ent = &scratch;
 	char			index[MAXNDXSIZE];
 	Word			i, nelts;
-	Addr			addr, addr0, offset = 0;
+	Addr			addr, addr0 = 0, offset = 0;
 	Addr			exc_addr = _cache->c_shdr->sh_addr;
 
 	dbg_print(0, MSG_INTL(MSG_EXR_TITLE));
@@ -763,7 +823,6 @@
 		 * that addresses grow monotonically.
 		 */
 		addr = SRELPTR(ret_addr);
-		/*LINTED:E_VAR_USED_BEFORE_SET*/
 		if ((i != 0) && (addr0 > addr))
 			(void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSORT),
 			    file, _cache->c_name, EC_WORD(i));
@@ -3681,6 +3740,9 @@
 				    do_swap, pnstate.pn_type, pnstate.pn_desc,
 				    pnstate.pn_descsz);
 				switch (corenote_ret) {
+				case CORENOTE_R_OK_DUMP:
+					hexdump = 1;
+					break;
 				case CORENOTE_R_OK:
 					hexdump = 0;
 					break;
@@ -3698,6 +3760,13 @@
 					    conv_ehdr_mach(ehdr->e_machine,
 					    0, &inv_buf));
 					break;
+				case CORENOTE_R_BADTYPE:
+					(void) fprintf(stderr,
+					    MSG_INTL(MSG_NOTE_BADCORETYPE),
+					    file,
+					    EC_WORD(pnstate.pn_type));
+					break;
+
 				}
 			}
 
@@ -4918,6 +4987,8 @@
 		    &shnum, &flags) == 0)
 			return (ret);
 		break;
+	case CACHE_OK:
+		break;
 	case CACHE_FAIL:
 		return (ret);
 	}
