mirror of
https://github.com/termux/termux-packages.git
synced 2024-11-21 20:56:19 +00:00
352a790d2f
QtWebKit is unmaintained and insecure with multiple remote code execution vulnerabilities - see: https://blogs.gnome.org/mcatanzaro/2022/11/04/stop-using-qtwebkit/
51 lines
1.7 KiB
Diff
51 lines
1.7 KiB
Diff
Remove `std::random_shuffle` usage (removed in C++17)
|
|
|
|
https://github.com/WebKit/WebKit/commit/0fbd42d50de66ad019249e8727dd3bd24dedf7cb
|
|
|
|
--- a/Source/JavaScriptCore/jit/BinarySwitch.cpp
|
|
+++ b/Source/JavaScriptCore/jit/BinarySwitch.cpp
|
|
@@ -137,6 +137,27 @@ bool BinarySwitch::advance(MacroAssembler& jit)
|
|
}
|
|
}
|
|
|
|
+class RandomNumberGenerator {
|
|
+public:
|
|
+ using result_type = uint32_t;
|
|
+
|
|
+ RandomNumberGenerator(WeakRandom& weakRandom)
|
|
+ : m_weakRandom(weakRandom)
|
|
+ {
|
|
+ }
|
|
+
|
|
+ uint32_t operator()()
|
|
+ {
|
|
+ return m_weakRandom.getUint32();
|
|
+ }
|
|
+
|
|
+ static constexpr uint32_t min() { return std::numeric_limits<uint32_t>::min(); }
|
|
+ static constexpr uint32_t max() { return std::numeric_limits<uint32_t>::max(); }
|
|
+
|
|
+private:
|
|
+ WeakRandom& m_weakRandom;
|
|
+};
|
|
+
|
|
void BinarySwitch::build(unsigned start, bool hardStart, unsigned end)
|
|
{
|
|
if (BinarySwitchInternal::verbose)
|
|
@@ -195,13 +216,9 @@ void BinarySwitch::build(unsigned start, bool hardStart, unsigned end)
|
|
for (unsigned i = 0; i < size; ++i)
|
|
localCaseIndices.append(start + i);
|
|
|
|
- std::random_shuffle(
|
|
+ std::shuffle(
|
|
localCaseIndices.begin(), localCaseIndices.end(),
|
|
- [this] (unsigned n) {
|
|
- // We use modulo to get a random number in the range we want fully knowing that
|
|
- // this introduces a tiny amount of bias, but we're fine with such tiny bias.
|
|
- return m_weakRandom.getUint32() % n;
|
|
- });
|
|
+ RandomNumberGenerator(m_weakRandom));
|
|
|
|
for (unsigned i = 0; i < size - 1; ++i) {
|
|
append(BranchCode(NotEqualToPush, localCaseIndices[i]));
|