Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for clang scan with libarchive imports #529

Merged
merged 3 commits into from
Jan 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions libarchive/archive_read_support_format_iso9660.c
Original file line number Diff line number Diff line change
Expand Up @@ -1133,8 +1133,6 @@ parse_rockridge_TF1(struct file_info *file, const unsigned char *data,
if ((flag & 8) && data_length >= 17) {
/* Attribute change time. */
file->ctime = isodate17(data);
data += 17;
data_length -= 17;
}
} else {
/* Use 7-byte time format. */
Expand All @@ -1159,8 +1157,6 @@ parse_rockridge_TF1(struct file_info *file, const unsigned char *data,
if ((flag & 8) && data_length >= 7) {
/* Attribute change time. */
file->ctime = isodate7(data);
data += 7;
data_length -= 7;
}
}
}
Expand Down
6 changes: 1 addition & 5 deletions libarchive/archive_read_support_format_mtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -1037,11 +1037,7 @@ parse_escapes(char *src, struct mtree_entry *mentry)
char *dest = src;
char c;

/*
* The current directory is somewhat special, it should be archived
* only once as it will confuse extraction otherwise.
*/
if (strcmp(src, ".") == 0)
if (mentry != NULL && strcmp(src, ".") == 0)
mentry->full = 1;

while (*src != '\0') {
Expand Down
18 changes: 7 additions & 11 deletions libarchive/archive_read_support_format_tar.c
Original file line number Diff line number Diff line change
Expand Up @@ -2099,20 +2099,16 @@ tar_atol256(const char *_p, unsigned char_cnt)
upper_limit = INT64_MAX / 256;
lower_limit = INT64_MIN / 256;

/* Pad with 1 or 0 bits, depending on sign. */
/* Sign-extend the 7-bit value to 64 bits. */
if ((0x40 & *p) == 0x40)
l = (int64_t)-1;
l = ~((int64_t)0x3f) | *p++;
else
l = 0;
l = (l << 6) | (0x3f & *p++);
l = 0x3f & *p++;
while (--char_cnt > 0) {
if (l > upper_limit) {
l = INT64_MAX; /* Truncate on overflow */
break;
} else if (l < lower_limit) {
l = INT64_MIN;
break;
}
if (l > upper_limit)
return (INT64_MAX); /* Truncate on overflow */
else if (l < lower_limit)
return (INT64_MIN);
l = (l << 8) | (0xff & (int64_t)*p++);
}
return (l);
Expand Down