hapostgres / hapostgres/pg_auto_failover

Don't reference temporaries when using intToString

Open
#758 0 comments 0 reactions 1 assignee Claimed by @DimCitus View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.