Bufer overrun in getValueTypeList()

Hi Duncan,

I’ve modified my backend such that the function isn’t called anymore with iPTR. I still think that if iPTR is an invalid input to getValueTypeList() that the function should have at least an assert checking that.

Thanks,

Javier

Hi Javier,

> I’ve observed in some tests that getValueTypeList() is sometimes called
> with type MVT::iPTR.

I think this is a bug, and you would do best to open a bugreport with a
testcase.

Ciao,

Duncan.

Hi Javier,

I’ve modified my backend such that the function isn’t called anymore
with iPTR. I still think that if iPTR is an invalid input to
getValueTypeList() that the function should have at least an assert
checking that.

I agree - please post a patch adding one.

Ciao,

Duncan.

Hello,

The attached patch is to add an assert to getValueTypeList() to verify that for simple value types their value is NOT between MAX_ALLOWED_VALUETYPE and LastSimpleValueType (inclusive) as this causes a buffer overrun.

Thanks,
Javier

SelectionDAG.cpp.patch (511 Bytes)

Hi Javier,

The attached patch is to add an assert to getValueTypeList() to verify that for simple value types their value is NOT between MAX_ALLOWED_VALUETYPE and LastSimpleValueType (inclusive) as this causes a buffer overrun.

thanks for the patch. I applied a variant in commit 103391.

Ciao,

Duncan.