PR24061, powerpc-ibm-aix-ar sets bogus file permissions when extracting

Mode field should be read in octal, all the rest in decimal.  Do so.

	PR 24061
	PR 21786
	* coff-rs6000.c (GET_VALUE_IN_FIELD): Add base parameter and
	adjust all callers.
	(EQ_VALUE_IN_FIELD): Likewise.
	* coff64-rs6000.c (GET_VALUE_IN_FIELD): Likewise.
This commit is contained in:
Alan Modra
2019-01-04 12:18:36 +10:30
parent 8261e52d1b
commit 677bd4c69d
3 changed files with 53 additions and 44 deletions

View File

@@ -1878,13 +1878,13 @@ _bfd_strntoll (const char * nptr, int base, unsigned int maxlen)
}
/* Macro to read an ASCII value stored in an archive header field. */
#define GET_VALUE_IN_FIELD(VAR, FIELD) \
do \
{ \
(VAR) = sizeof (VAR) > sizeof (long) \
? _bfd_strntoll (FIELD, 10, sizeof FIELD) \
: _bfd_strntol (FIELD, 10, sizeof FIELD); \
} \
#define GET_VALUE_IN_FIELD(VAR, FIELD, BASE) \
do \
{ \
(VAR) = (sizeof (VAR) > sizeof (long) \
? _bfd_strntoll (FIELD, BASE, sizeof FIELD) \
: _bfd_strntol (FIELD, BASE, sizeof FIELD)); \
} \
while (0)
/* Read in the armap of an XCOFF archive. */
@@ -1927,7 +1927,7 @@ xcoff64_slurp_armap (bfd *abfd)
return FALSE;
/* Skip the name (normally empty). */
GET_VALUE_IN_FIELD (namlen, hdr.namlen);
GET_VALUE_IN_FIELD (namlen, hdr.namlen, 10);
pos = ((namlen + 1) & ~(size_t) 1) + SXCOFFARFMAG;
if (bfd_seek (abfd, pos, SEEK_CUR) != 0)
return FALSE;