mirror of
https://github.com/XRPLF/rippled.git
synced 2026-02-25 08:12:38 +00:00
Compare commits
2 Commits
develop
...
pratik/Add
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
80465868fc | ||
|
|
6f5c54a4cc |
@@ -111,6 +111,7 @@ words:
|
|||||||
- gpgcheck
|
- gpgcheck
|
||||||
- gpgkey
|
- gpgkey
|
||||||
- hotwallet
|
- hotwallet
|
||||||
|
- hwaddress
|
||||||
- hwrap
|
- hwrap
|
||||||
- ifndef
|
- ifndef
|
||||||
- inequation
|
- inequation
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <xrpl/basics/sanitizers.h>
|
||||||
#include <xrpl/beast/type_name.h>
|
#include <xrpl/beast/type_name.h>
|
||||||
|
|
||||||
#include <exception>
|
#include <exception>
|
||||||
@@ -24,7 +25,7 @@ LogThrow(std::string const& title);
|
|||||||
control to the next matching exception handler, if any.
|
control to the next matching exception handler, if any.
|
||||||
Otherwise, std::terminate will be called.
|
Otherwise, std::terminate will be called.
|
||||||
*/
|
*/
|
||||||
[[noreturn]] inline void
|
[[noreturn]] XRPL_NO_SANITIZE_ADDRESS inline void
|
||||||
Rethrow()
|
Rethrow()
|
||||||
{
|
{
|
||||||
LogThrow("Re-throwing exception");
|
LogThrow("Re-throwing exception");
|
||||||
@@ -32,7 +33,7 @@ Rethrow()
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class E, class... Args>
|
template <class E, class... Args>
|
||||||
[[noreturn]] inline void
|
[[noreturn]] XRPL_NO_SANITIZE_ADDRESS inline void
|
||||||
Throw(Args&&... args)
|
Throw(Args&&... args)
|
||||||
{
|
{
|
||||||
static_assert(
|
static_assert(
|
||||||
|
|||||||
6
include/xrpl/basics/sanitizers.h
Normal file
6
include/xrpl/basics/sanitizers.h
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
// Helper to disable ASan/HwASan for specific functions
|
||||||
|
#if defined(__GNUC__) || defined(__clang__)
|
||||||
|
#define XRPL_NO_SANITIZE_ADDRESS __attribute__((no_sanitize("address", "hwaddress")))
|
||||||
|
#else
|
||||||
|
#define XRPL_NO_SANITIZE_ADDRESS
|
||||||
|
#endif
|
||||||
@@ -258,7 +258,7 @@ Number::Guard::doRoundUp(
|
|||||||
}
|
}
|
||||||
bringIntoRange(negative, mantissa, exponent, minMantissa);
|
bringIntoRange(negative, mantissa, exponent, minMantissa);
|
||||||
if (exponent > maxExponent)
|
if (exponent > maxExponent)
|
||||||
throw std::overflow_error(location);
|
Throw<std::overflow_error>(std::string(location));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <UnsignedMantissa T>
|
template <UnsignedMantissa T>
|
||||||
@@ -298,7 +298,7 @@ Number::Guard::doRound(rep& drops, std::string location)
|
|||||||
// or "(maxRep + 1) / 10", neither of which will round up when
|
// or "(maxRep + 1) / 10", neither of which will round up when
|
||||||
// converting to rep, though the latter might overflow _before_
|
// converting to rep, though the latter might overflow _before_
|
||||||
// rounding.
|
// rounding.
|
||||||
throw std::overflow_error(location); // LCOV_EXCL_LINE
|
Throw<std::overflow_error>(std::string(location)); // LCOV_EXCL_LINE
|
||||||
}
|
}
|
||||||
++drops;
|
++drops;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user