Skip to content

Commit a472730

Browse files
committed
alloc bigger tx bufs
1 parent 19125db commit a472730

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/common.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include <common/parser.h>
2020
#include <sstream>
21+
#include <memory>
2122
#include <string>
2223
#include <fmt/core.h>
2324
#include "common.h"
@@ -26,6 +27,7 @@
2627
#include <json/json.h>
2728
#include <app_mode.h>
2829
#include <hexutils.h>
30+
#include <stdlib.h>
2931

3032
std::vector<std::string> dumpUI(parser_context_t *ctx,
3133
uint16_t maxKeyLen,
@@ -131,8 +133,11 @@ void check_testcase(const testcase_t &tc, bool expert_mode) {
131133
parser_context_t ctx = {0};
132134
parser_error_t err = parser_unexpected_error;
133135

134-
uint8_t buffer[10000] = {0};
135-
const uint16_t bufferLen = parseHexString(buffer, sizeof(buffer), tc.blob.c_str());
136+
auto bufferCap = 1<<17; // 132 KiB
137+
std::unique_ptr<uint8_t> buffer{new int[bufferCap]};
138+
if (buffer == nullptr) { abort(); }
139+
140+
const uint16_t bufferLen = parseHexString(buffer, bufferCap, tc.blob.c_str());
136141

137142
parser_tx_t tx_obj;
138143
memset(&tx_obj, 0, sizeof(tx_obj));

0 commit comments

Comments
 (0)