bug in function strtoint, on Windows OS won't report ERANGE

From: Miron Berlin <mironatpro(at)hotmail(dot)com>
To: "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: bug in function strtoint, on Windows OS won't report ERANGE
Date: 2024-03-05 12:15:26
Message-ID: DM4P223MB0518D09B523522F099A97E2CC0222@DM4P223MB0518.NAMP223.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Dear Postgres Dev Team,

Functionstrtoint has a bug. It would not report ERANGE on Windows OS compiled with Microsoft Visual Studio compiler.
To work correctly please replace call to strtol with call to strtoll ( please note two letters l on the right hand side ).
This function should produce correct data type on all available platforms.
In addition, please modify type of the variable val declared at the top of the function from long to an portable 64 bit long integer.
For example long long.

Please note, an substitution of function strtoint with strtol sets errno as expected on Windows platform.
Please note, fixing this bug may have wide impact due to frequent use of function strtoint in various lexer(s).

Thanks,

Miron

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message jian he 2024-03-05 13:22:08 Re: BUG #18314: PARALLEL UNSAFE function does not prevent parallel index build
Previous Message Tender Wang 2024-03-05 11:49:44 Re: BUG #18314: PARALLEL UNSAFE function does not prevent parallel index build