svn commit: r342580 - head/usr.bin/ar

Ed Maste emaste at FreeBSD.org
Fri Dec 28 22:47:56 UTC 2018


Author: emaste
Date: Fri Dec 28 22:47:55 2018
New Revision: 342580
URL: https://svnweb.freebsd.org/changeset/base/342580

Log:
  ar: detect and error out on 32-bit symbol table overflow
  
  BSD ar currently does not support the /SYM64/ 64-bit symbol table, and
  previously truncated to 32-bits, silently producing corrupted archives
  larger than 4GB.
  
  This is another overflow case in addtion to r342575.
  
  PR:		234454
  Reported by:	Aijaz Baig, imp
  MFC after:	2 weeks
  MFC with:	r342575
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/usr.bin/ar/write.c

Modified: head/usr.bin/ar/write.c
==============================================================================
--- head/usr.bin/ar/write.c	Fri Dec 28 21:26:45 2018	(r342579)
+++ head/usr.bin/ar/write.c	Fri Dec 28 22:47:55 2018	(r342580)
@@ -628,6 +628,9 @@ write_objs(struct bsdar *bsdar)
 		if (strlen(obj->name) > _MAXNAMELEN_SVR4)
 			add_to_ar_str_table(bsdar, obj->name);
 		bsdar->rela_off += _ARHDR_LEN + obj->size + obj->size % 2;
+		if (bsdar->rela_off > UINT32_MAX)
+			bsdar_errc(bsdar, EX_SOFTWARE, 0,
+			    "Symbol table offset overflow");
 	}
 
 	/*


More information about the svn-src-head mailing list