sljit icon indicating copy to clipboard operation
sljit copied to clipboard

OVERFLOW_AFTER_CHECK in sljitNativeX86_common.c

Open ellena13 opened this issue 1 year ago • 1 comments

Dear colleagues, hello everyone! I started this issue because the static analyzer has detected OVERFLOW_AFTER_CHECK in sljitNativeX86_common.c and sljitNativeX86_64.c. I was recommended to contact you :) to solve the problem

ellena13 avatar Aug 28 '24 03:08 ellena13

What would be a possible solution?

The sljit has an optional argument validation system, which can assert or return with an error code if the arguments are invalid. It can be enabled with compile time macros. These checks are costly and recommended in debug mode. Please check the code starting here: https://github.com/zherczeg/sljit/blob/master/sljit_src/sljitLir.c#L1242

After the validation step, the arguments are not validated anymore. In this case, the layout of src/destination operands has a fixed bit layout regardless of cpu, and not all cpu uses all bits. The checkers are not cpu specific.

zherczeg avatar Aug 28 '24 04:08 zherczeg