Skip to content

Commit

Permalink
fix: segfault on unit test (opentibiabr#2808)
Browse files Browse the repository at this point in the history
Fix segfault running unit test when building with linux-debug preset.

---------

Co-authored-by: GitHub Actions <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
Costallat and github-actions[bot] authored Aug 12, 2024
1 parent 6eb4238 commit 3a7897d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ jobs:
path: |
${{ github.workspace }}/build/${{ matrix.buildtype }}/bin/
# - name: Run Unit Tests
# run: |
# cd ${{ github.workspace }}/build/${{ matrix.buildtype }}/tests/unit
# ctest --verbose
- name: Run Unit Tests
run: |
cd ${{ github.workspace }}/build/${{ matrix.buildtype }}/tests/unit
ctest --verbose
# - name: Run Integration Tests
# run: |
Expand Down
6 changes: 3 additions & 3 deletions src/security/argon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@

#include <argon2.h>

const std::regex Argon2::re("\\$([A-Za-z0-9+/]+)\\$([A-Za-z0-9+/]+)");
const std::string Argon2::base64_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

Argon2::Argon2() {
updateConstants();
}
Expand All @@ -44,6 +41,8 @@ uint32_t Argon2::parseBitShift(const std::string &bitShiftStr) const {
}

bool Argon2::verifyPassword(const std::string &password, const std::string &phash) const {

const std::regex re("\\$([A-Za-z0-9+/]+)\\$([A-Za-z0-9+/]+)");
std::smatch match;
if (!std::regex_search(phash, match, re)) {
g_logger().debug("No argon2 hash found in string");
Expand All @@ -65,6 +64,7 @@ bool Argon2::verifyPassword(const std::string &password, const std::string &phas
}

std::vector<uint8_t> Argon2::base64_decode(const std::string &input) const {
const std::string base64_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
std::vector<uint8_t> ret;
int i = 0;
uint32_t val = 0;
Expand Down

0 comments on commit 3a7897d

Please sign in to comment.