[PATCH 2/2] Object/WasmObjectFile: Fix comparison of different signs
Sam Clegg via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 12 07:58:20 PDT 2018
Why doesn't this show up in my local build or on the wasm waterfall builder?
Also, presumably we don't want to be using C-style casts? static_cast?
On Mon, Jun 11, 2018 at 4:15 PM, Derek Schuff <dschuff at google.com> wrote:
> + sbc at chromium.org
>
>
> On Mon, Jun 11, 2018 at 12:08 AM Hans Wennborg via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
>>
>> - llvm-dev
>> + llvm-commits
>>
>> Sam, this looks like your code. Can you take a look?
>>
>> On Sun, Jun 10, 2018 at 3:34 PM, Mauro Rossi <issor.oruam at gmail.com>
>> wrote:
>> > Fixes the following building error:
>> >
>> > external/llvm/lib/Object/WasmObjectFile.cpp:978:14:
>> > error: comparison of integers of different signs:
>> > 'uint32_t' (aka 'unsigned int') and 'int' [-Werror,-Wsign-compare]
>> > if (Size > Ctx.End - Ctx.Ptr)
>> > ~~~~ ^ ~~~~~~~~~~~~~~~~~
>> > 1 error generated.
>> >
>> > Fixes: 50617cfe72 ("[WebAssembly] Add more error checking to object file
>> > parsing")
>> > ---
>> > lib/Object/WasmObjectFile.cpp | 2 +-
>> > 1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> > diff --git a/lib/Object/WasmObjectFile.cpp
>> > b/lib/Object/WasmObjectFile.cpp
>> > index 2f91a973dda..ba5e6ac4cb3 100644
>> > --- a/lib/Object/WasmObjectFile.cpp
>> > +++ b/lib/Object/WasmObjectFile.cpp
>> > @@ -975,7 +975,7 @@ Error WasmObjectFile::parseDataSection(ReadContext
>> > &Ctx) {
>> > if (Error Err = readInitExpr(Segment.Data.Offset, Ctx))
>> > return Err;
>> > uint32_t Size = readVaruint32(Ctx);
>> > - if (Size > Ctx.End - Ctx.Ptr)
>> > + if (Size > (uint32_t) (Ctx.End - Ctx.Ptr))
>> > return make_error<GenericBinaryError>("Invalid segment size",
>> >
>> > object_error::parse_failed);
>> > Segment.Data.Content = ArrayRef<uint8_t>(Ctx.Ptr, Size);
>> > --
>> > 2.17.1
>> >
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list