parse: avoid UB on double to integer casts
parse: avoid UB on double to integer casts

Casting floating point values to an integer type is undefined
behaviour if it's not a regular number or the integral part cannot be
represented in the integer type.

This fixes issues found by UBSAN in libass' public OSS-Fuzz corpus
where NAN ("be") or a too large value ("k") was casted to int.

Sample IDs (one instance each there are duplicates):
  OSSFuzz-3617a28ea3900c2603059049ce4c70c01a535a3e
  OSSFuzz-292a3032ea273cc9dbaaa0a4291dd84e0cc07c65

astiob/libass,libass/libass,ShiftMediaProject/libass,ShiftMediaProject/libass,astiob/libass,libass/libass