Skip to content

Commit

Permalink
Put bounds on the number of CPUID leaves explored
Browse files Browse the repository at this point in the history
  • Loading branch information
sipa authored and Fuzzbawls committed Mar 31, 2021
1 parent 0952040 commit 9208a09
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/randomenv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ void AddAllCPUID(CSHA512& hasher)
// Iterate over all standard leaves
AddCPUID(hasher, 0, 0, ax, bx, cx, dx); // Returns max leaf in ax
uint32_t max = ax;
for (uint32_t leaf = 1; leaf <= max; ++leaf) {
for (uint32_t leaf = 1; leaf <= max && leaf <= 0xFF; ++leaf) {
uint32_t maxsub = 0;
for (uint32_t subleaf = 0;; ++subleaf) {
for (uint32_t subleaf = 0; subleaf <= 0xFF; ++subleaf) {
AddCPUID(hasher, leaf, subleaf, ax, bx, cx, dx);
// Iterate subleafs for leaf values 4, 7, 11, 13
if (leaf == 4) {
Expand All @@ -221,7 +221,7 @@ void AddAllCPUID(CSHA512& hasher)
// Iterate over all extended leaves
AddCPUID(hasher, 0x80000000, 0, ax, bx, cx, dx); // Returns max extended leaf in ax
uint32_t ext_max = ax;
for (uint32_t leaf = 0x80000001; leaf <= ext_max; ++leaf) {
for (uint32_t leaf = 0x80000001; leaf <= ext_max && leaf <= 0x800000FF; ++leaf) {
AddCPUID(hasher, leaf, 0, ax, bx, cx, dx);
}
}
Expand Down

0 comments on commit 9208a09

Please sign in to comment.