9422ba
--- binutils.orig/bfd/peXXigen.c	2018-07-11 14:28:44.937231840 +0100
9422ba
+++ binutils-2.29.1/bfd/peXXigen.c	2018-07-11 14:29:27.861771394 +0100
9422ba
@@ -2992,6 +2992,16 @@ _bfd_XX_bfd_copy_private_bfd_data_common
9422ba
 	      return FALSE;
9422ba
 	    }
9422ba
 
9422ba
+	  /* PR 23110.  */
9422ba
+	  else if (ope->pe_opthdr.DataDirectory[PE_DEBUG_DATA].Size < 0)
9422ba
+	    {
9422ba
+	      /* xgettext:c-format */
9422ba
+	      _bfd_error_handler
9422ba
+		(_("%pB: Data Directory size (%#lx) is negative"),
9422ba
+		 obfd, ope->pe_opthdr.DataDirectory[PE_DEBUG_DATA].Size);
9422ba
+	      return FALSE;
9422ba
+	    }
9422ba
+
9422ba
           for (i = 0; i < ope->pe_opthdr.DataDirectory[PE_DEBUG_DATA].Size
9422ba
 		 / sizeof (struct external_IMAGE_DEBUG_DIRECTORY); i++)
9422ba
             {