8160090: Better signature handling in pack200
Reviewed-by: jrose, mschoene
This commit is contained in:
parent
8da66ad674
commit
4e9407c775
@ -174,7 +174,10 @@ struct entry {
|
|||||||
|
|
||||||
const char* utf8String() {
|
const char* utf8String() {
|
||||||
assert(tagMatches(CONSTANT_Utf8));
|
assert(tagMatches(CONSTANT_Utf8));
|
||||||
assert(value.b.len == strlen((const char*)value.b.ptr));
|
if (value.b.len != strlen((const char*)value.b.ptr)) {
|
||||||
|
unpack_abort("bad utf8 encoding");
|
||||||
|
// and fall through
|
||||||
|
}
|
||||||
return (const char*)value.b.ptr;
|
return (const char*)value.b.ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1319,10 +1322,10 @@ void unpacker::read_signature_values(entry* cpMap, int len) {
|
|||||||
CHECK;
|
CHECK;
|
||||||
int nc = 0;
|
int nc = 0;
|
||||||
|
|
||||||
for ( const char* ncp = form.utf8String() ; *ncp; ncp++) {
|
for (int j = 0; j < (int)form.value.b.len; j++) {
|
||||||
if (*ncp == 'L') nc++;
|
int c = form.value.b.ptr[j];
|
||||||
|
if (c == 'L') nc++;
|
||||||
}
|
}
|
||||||
|
|
||||||
ncTotal += nc;
|
ncTotal += nc;
|
||||||
e.refs = U_NEW(entry*, cpMap[i].nrefs = 1 + nc);
|
e.refs = U_NEW(entry*, cpMap[i].nrefs = 1 + nc);
|
||||||
CHECK;
|
CHECK;
|
||||||
@ -5051,6 +5054,7 @@ unpacker::file* unpacker::get_next_file() {
|
|||||||
entry* e = file_name.getRef();
|
entry* e = file_name.getRef();
|
||||||
CHECK_0;
|
CHECK_0;
|
||||||
cur_file.name = e->utf8String();
|
cur_file.name = e->utf8String();
|
||||||
|
CHECK_0;
|
||||||
bool haveLongSize = (testBit(archive_options, AO_HAVE_FILE_SIZE_HI));
|
bool haveLongSize = (testBit(archive_options, AO_HAVE_FILE_SIZE_HI));
|
||||||
cur_file.size = file_size_hi.getLong(file_size_lo, haveLongSize);
|
cur_file.size = file_size_hi.getLong(file_size_lo, haveLongSize);
|
||||||
if (testBit(archive_options, AO_HAVE_FILE_MODTIME))
|
if (testBit(archive_options, AO_HAVE_FILE_MODTIME))
|
||||||
|
Loading…
Reference in New Issue
Block a user