mirror of
https://github.com/aria2/aria2.git
synced 2025-02-26 08:22:11 +00:00
Fix test errors with ubsan
This commit is contained in:
parent
dfdbc22b23
commit
e5d9ad2f0b
@ -662,7 +662,7 @@ bool BitfieldMan::isUseBitSet(size_t index) const
|
||||
void BitfieldMan::setBitfield(const unsigned char* bitfield,
|
||||
size_t bitfieldLength)
|
||||
{
|
||||
if (bitfieldLength_ != bitfieldLength) {
|
||||
if (bitfieldLength_ == 0 || bitfieldLength_ != bitfieldLength) {
|
||||
return;
|
||||
}
|
||||
memcpy(bitfield_, bitfield, bitfieldLength_);
|
||||
|
@ -300,12 +300,18 @@ std::unique_ptr<Cookie> parse(const std::string& cookieStr,
|
||||
}
|
||||
else {
|
||||
int64_t n = creationTime;
|
||||
n += delta;
|
||||
if (n < 0 || std::numeric_limits<time_t>::max() < n) {
|
||||
maxAge = std::numeric_limits<time_t>::max();
|
||||
}
|
||||
else {
|
||||
maxAge = n;
|
||||
|
||||
if (n > std::numeric_limits<int64_t>::max() - delta) {
|
||||
maxAge = std::numeric_limits<int64_t>::max();
|
||||
} else {
|
||||
n += delta;
|
||||
|
||||
if (n < 0 || std::numeric_limits<time_t>::max() < n) {
|
||||
maxAge = std::numeric_limits<time_t>::max();
|
||||
}
|
||||
else {
|
||||
maxAge = n;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user