[OpenMP] Fix potential integer overflow in dynamic schedule code

Restrict the chunk_size * chunk_num to only occur for valid
chunk_nums and reimplement calculating the limit to avoid overflow.

Differential Revision: https://reviews.llvm.org/D96747

GitOrigin-RevId: e2738b3758a9d5a6dfdc5a6768046b44a1b9f135
2 files changed