@@ -196,9 +196,9 @@ void AddAllCPUID(CSHA512& hasher)
196196 // Iterate over all standard leaves
197197 AddCPUID (hasher, 0 , 0 , ax, bx, cx, dx); // Returns max leaf in ax
198198 uint32_t max = ax;
199- for (uint32_t leaf = 1 ; leaf <= max; ++leaf) {
199+ for (uint32_t leaf = 1 ; leaf <= max && leaf <= 0xFF ; ++leaf) {
200200 uint32_t maxsub = 0 ;
201- for (uint32_t subleaf = 0 ;; ++subleaf) {
201+ for (uint32_t subleaf = 0 ; subleaf <= 0xFF ; ++subleaf) {
202202 AddCPUID (hasher, leaf, subleaf, ax, bx, cx, dx);
203203 // Iterate subleafs for leaf values 4, 7, 11, 13
204204 if (leaf == 4 ) {
@@ -219,7 +219,7 @@ void AddAllCPUID(CSHA512& hasher)
219219 // Iterate over all extended leaves
220220 AddCPUID (hasher, 0x80000000 , 0 , ax, bx, cx, dx); // Returns max extended leaf in ax
221221 uint32_t ext_max = ax;
222- for (uint32_t leaf = 0x80000001 ; leaf <= ext_max; ++leaf) {
222+ for (uint32_t leaf = 0x80000001 ; leaf <= ext_max && leaf <= 0x800000FF ; ++leaf) {
223223 AddCPUID (hasher, leaf, 0 , ax, bx, cx, dx);
224224 }
225225}
0 commit comments