cocofabio opened a new pull request, #2571:
URL: https://github.com/apache/age/pull/2571

   Closes #2514.
   
   `agtype_mod` left the zero divisor unguarded. On x86_64 an integer `% 0` 
traps as SIGFPE, which PostgreSQL reports as `floating-point exception` 
(22P01); on aarch64 it silently returns the dividend. The float branches 
returned NaN. `agtype_div` right above already checks for it, and PostgreSQL's 
`int8mod` does the same, so this adds the same guard to all four scalar 
branches (the numeric branch already errors through `numeric_mod`). The integer 
branch also special-cases `INT64_MIN % -1`, which is zero but overflows the 
quotient - again matching `int8mod`.
   
   Regression tests go next to the existing `agtype_div` zero-divisor block in 
`regress/sql/agtype.sql`. Without the fix the `agtype` test fails 
(`agtype_mod('1','0')` returns 1); with it, it passes. The full suite has 5 
failures on my macOS/PG 18.6 host (`scan`, `catalog`, `expr`, `cypher_create`, 
`age_load`) - the identical set fails on unmodified master here, and none of 
those diffs touch `agtype_mod`.
   
   `RETURN 5 % 0` now reports `division by zero`, matching `RETURN 5 / 0`.
   
   PR #2482 carried the same guard inside a larger overflow change; this keeps 
to the zero divisor only.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to