[LTP] [PATCH v2] misc: rewrite crash02 test

Andrea Cervesato andrea.cervesato@suse.com
Tue Jul 1 13:39:31 CEST 2025


On 6/30/25 3:51 PM, Martin Doucha wrote:
> This algorithm has two problems:
> 1. Undefined behavior if i == 3 && (rand() & 0xFF) > 0x7f
> 2. Except as a result of the above undefined behavior, the algorithm 
> will never generate a negative value nor a value larger than INT_MAX.
I see that using multiple rand() create an issue on the numeric 
dimension. By calling rand() multiple times and move the bytes results 
around, usually generates big numbers values.
Probably we should just get back to the old algorithm. WDYT?


More information about the ltp mailing list