mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Patch/fix ub (#724)
* Fix input validation in storage-manager and bitstring * Fix potentially dangling pointer missing_library --------- Co-authored-by: SpyCheese <mikle98@yandex.ru>
This commit is contained in:
parent
9b34217bf0
commit
ef306dd36e
10 changed files with 73 additions and 33 deletions
|
@ -596,7 +596,7 @@ long parse_bitstring_hex_literal(unsigned char* buff, std::size_t buff_size, con
|
|||
unsigned char* ptr = buff;
|
||||
const char* rptr = str;
|
||||
while (rptr < str_end) {
|
||||
int c = *rptr++;
|
||||
char c = *rptr++;
|
||||
if (c == ' ' || c == '\t') {
|
||||
continue;
|
||||
}
|
||||
|
@ -627,14 +627,14 @@ long parse_bitstring_hex_literal(unsigned char* buff, std::size_t buff_size, con
|
|||
if (cmpl && bits) {
|
||||
int t = (hex_digits_count & 1) ? (0x100 + *ptr) >> 4 : (0x100 + *--ptr);
|
||||
while (bits > 0) {
|
||||
if (t == 1) {
|
||||
t = 0x100 + *--ptr;
|
||||
}
|
||||
--bits;
|
||||
if (t & 1) {
|
||||
break;
|
||||
}
|
||||
t >>= 1;
|
||||
if (t == 1) {
|
||||
t = 0x100 + *--ptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
return bits;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue