Fix the overflow issue in Checkpoint
When the partition is f2fs and the OS is 32bit, the data.f_bavail and data.f_frsize are 32 bits in size. The product of them is also 32 bits in size. If the available size of storage is greater than 4G, the product may be greater than the unsigned long max value. If the product is overflow and less than 100M. The UDC feature will be disabled. There is also an overflow for std::strtoul when the variable content is a very big number(more the unsigned long max value). To avoid the overflow: 1. convert the variable data.f_bavvail to uint64_t and then compute the multiplication. 2. use std::strtoull replace to std::strtoul. Bug: 147118861 Change-Id: I60172ae4cb7c997e2ad4a36583be74736c25e565
Loading
Please register or sign in to comment