bloomberg / bloomberg/comdb2

Suspected implicit conversion errors

Open
#2,232 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
1.5k
Forks
243
Avg merge
2d 2h
Merged PRs (30d)
37

Description

At line 524 and 526 of sqlite/src/func.c, clang10 complains that
"error: implicit conversion from 'long long' to 'double' changes value from 9223372036854775806 to 9223372036854775808
if( n==0 && r>=0 && r=0 && r LLONG_MAX)".
The source code is
```c
dbl:if (darg < LLONG_MIN || darg > LLONG_MAX)
265 luaL_error(lua, "conversion to: int failed from: %f", darg);
266 *val= (long long) darg;
267 return;
```
If darg is 9223372036854775807.5(could this happen?), there might be a risk of overflow.

Contributor guide

Open the contributing guide

Research direction

Start with the reported expressions in sqlite/src/func.c at lines 524 and 526 and lua/ltypes.c around line 264, then compare the referenced SQLite commit. Reproduce the clang10 implicit-int-float-conversion diagnostics and determine whether the reported boundary values can overflow; done means the affected code builds without these errors and the conversion behavior is addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, lua, sqlite
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.