@@ -63,7 +63,7 @@ GetWasmString(llvm::DataExtractor &data, llvm::DataExtractor::Cursor &c) {
63
63
return std::nullopt;
64
64
}
65
65
66
- if (len >= ( uint64_t ( 1 ) << 32 )) {
66
+ if (len > std::numeric_limits< uint32_t >:: max ( )) {
67
67
return std::nullopt;
68
68
}
69
69
@@ -175,7 +175,7 @@ bool ObjectFileWasm::DecodeNextSection(lldb::offset_t *offset_ptr) {
175
175
if (!c)
176
176
return !llvm::errorToBool (c.takeError ());
177
177
178
- if (payload_len >= ( uint64_t ( 1 ) << 32 ))
178
+ if (payload_len > std::numeric_limits< uint32_t >:: max ( ))
179
179
return false ;
180
180
181
181
if (section_id == llvm::wasm::WASM_SEC_CUSTOM) {
@@ -256,15 +256,15 @@ ParseFunctions(SectionSP code_section_sp) {
256
256
lldb::offset_t offset = 0 ;
257
257
258
258
const uint64_t function_count = code_section_data.GetULEB128 (&offset);
259
- if (function_count >= std::numeric_limits<uint32_t >::max ())
259
+ if (function_count > std::numeric_limits<uint32_t >::max ())
260
260
return llvm::createStringError (" function count overflows uint32_t" );
261
261
262
262
std::vector<AddressRange> functions;
263
263
functions.reserve (function_count);
264
264
265
265
for (uint32_t i = 0 ; i < function_count; ++i) {
266
266
const uint64_t function_size = code_section_data.GetULEB128 (&offset);
267
- if (function_size >= std::numeric_limits<uint32_t >::max ())
267
+ if (function_size > std::numeric_limits<uint32_t >::max ())
268
268
return llvm::createStringError (" function size overflows uint32_t" );
269
269
// llvm-objdump considers the ULEB with the function size to be part of the
270
270
// function. We can't do that here because that would break symbolic
@@ -293,13 +293,13 @@ ParseNames(SectionSP name_section_sp,
293
293
while (c && c.tell () < data.size ()) {
294
294
const uint8_t type = data.getU8 (c);
295
295
const uint64_t size = data.getULEB128 (c);
296
- if (size >= std::numeric_limits<uint32_t >::max ())
296
+ if (size > std::numeric_limits<uint32_t >::max ())
297
297
return llvm::createStringError (" size overflows uint32_t" );
298
298
299
299
switch (type) {
300
300
case llvm::wasm::WASM_NAMES_FUNCTION: {
301
301
const uint64_t count = data.getULEB128 (c);
302
- if (count >= std::numeric_limits<uint32_t >::max ())
302
+ if (count > std::numeric_limits<uint32_t >::max ())
303
303
return llvm::createStringError (" function count overflows uint32_t" );
304
304
305
305
for (uint64_t i = 0 ; c && i < count; ++i) {
0 commit comments