hapostgres / hapostgres/pg_auto_failover
Don't reference temporaries when using intToString
Open
bug
enhancement
Size:M
- Dominant language
- C
- Stars
- 1.4k
- Forks
- 142
- Avg merge
- 5h 8m
- Merged PRs (30d)
- 1
Description
The following code that we use a lot is undefined behavior:
```c
paramValues[1] = intToString(index).strValue;
```
Instead it should be:
```c
IntString indexStr = intToString(index);
paramValues[1] = indexStr.strValue;
```
With the current code we're referencing temporaries, which can lead to all kinds of weird bugs.
Useful source: https://stackoverflow.com/a/17903361/2570866
Contributor guide
Assessment
This issue has not been assessed yet.