From 5d293e01fbf35262f91ebc45437a73fc4b10edd8 Mon Sep 17 00:00:00 2001 From: brichard19 Date: Fri, 27 Jul 2018 21:33:15 -0400 Subject: [PATCH] Critical bug fix -Fixed buffer overflow bug that was causing BitCrack.exe to crash when using address list --- KeyFinderLib/KeyFinder.cpp | 11 +++++++++-- KeyFinderLib/KeyFinder.cu | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/KeyFinderLib/KeyFinder.cpp b/KeyFinderLib/KeyFinder.cpp index fb2258f..e54862d 100644 --- a/KeyFinderLib/KeyFinder.cpp +++ b/KeyFinderLib/KeyFinder.cpp @@ -114,7 +114,9 @@ void KeyFinder::setTargetHashes() cudaError_t err = setTargetHash(targets); if(err) { - throw KeyFinderException("Error initializing device"); + std::string cudaErrorString(cudaGetErrorString(err)); + + throw KeyFinderException("Error initializing device: " + cudaErrorString); } } @@ -145,7 +147,12 @@ void KeyFinder::init() secp256k1::ecpoint g = secp256k1::G(); secp256k1::ecpoint p = secp256k1::multiplyPoint(secp256k1::uint256(_numThreads * _numBlocks * _pointsPerThread), g); - if(setIncrementorPoint(p.x, p.y)) { + cudaError_t err = setIncrementorPoint(p.x, p.y); + if(err) { + std::string cudaErrorString(cudaGetErrorString(err)); + + throw KeyFinderException("Error initializing device: " + cudaErrorString); + throw KeyFinderException("Error initializing device"); } } diff --git a/KeyFinderLib/KeyFinder.cu b/KeyFinderLib/KeyFinder.cu index d5d199e..354b8ff 100644 --- a/KeyFinderLib/KeyFinder.cu +++ b/KeyFinderLib/KeyFinder.cu @@ -109,7 +109,7 @@ static cudaError_t setTargetBloomFilter(const std::vector &targe undoRMD160FinalRound(targets[i].h, h); for(int j = 0; j < 5; j++) { - unsigned int idx = h[i] & 0xffff; + unsigned int idx = h[j] & 0xffff; filter[idx / 32] |= (0x01 << (idx % 32)); }