Fix off-by-one bug and add a unit test

This commit is contained in:
mio
2024-10-13 15:19:05 +08:00
parent 579317bb21
commit fbf34af81c
2 changed files with 5 additions and 1 deletions

3
uc.c
View File

@@ -2523,7 +2523,8 @@ uc_err uc_ctl(uc_engine *uc, uc_control_type control, ...)
break;
}
while (page_size) {
// Bits is used to calculate the mask
while (page_size > 1) {
bits++;
page_size >>= 1;
}