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
This commit is contained in:
Ed Maste 2018-12-28 22:47:55 +00:00
parent 557a5ad425
commit ac8e938122
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=342580

View File

@ -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");
}
/*