| 264 | } |
| 265 | |
| 266 | bool SaveStateLoading::debugIsMatchingPage(char* addr) |
| 267 | { |
| 268 | char current_page[4096]; |
| 269 | |
| 270 | if (current_flag == Area::FULL_PAGE) { |
| 271 | lseek(pfd, next_pfd_offset - 4096, SEEK_SET); |
| 272 | Utils::readAll(pfd, current_page, 4096); |
| 273 | } |
| 274 | else if (current_flag == Area::COMPRESSED_PAGE) { |
| 275 | char compressed[LZ4_COMPRESSBOUND(4096)]; |
| 276 | if (!validateCompressedLength()) { |
| 277 | memset(current_page, 0, 4096); |
| 278 | return false; |
| 279 | } |
| 280 | Utils::readAll(pfd, compressed, compressed_length); |
| 281 | int ret = LZ4_decompress_safe(compressed, current_page, compressed_length, 4096); |
| 282 | if (ret != 4096) { |
| 283 | LOG(LL_ERROR, LCF_CHECKPOINT, "LZ4_decompress_safe failed with return code %d", ret); |
| 284 | memset(current_page, 0, 4096); |
| 285 | return false; |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | return 0 == memcmp(addr, current_page, 4096); |
| 290 | } |
| 291 | |
| 292 | } |
no test coverage detected