[pgpool-committers: 6623] pgpool: Fix problems in watchdog processing json data.

Tatsuo Ishii ishii at sraoss.co.jp
Fri Mar 13 10:50:19 JST 2020


Fix problems in watchdog processing json data.

Comment on the patch from the author:

In the watchdog source code (src/watchdog/wd_json_data.c), there are some instances of bad handling of values read from json data.
For example:
1) The boolean pool configuration settings "load_balance_mode" and "master_slave_mode" are read using json_get_int_value_for_key(), resulting in 4-bytes being written into their location within the POOL_CONFIG, yet (being bool) they are only 1-byte long. This corrupts the values of the structure members following them.
2) Similarly, when parsing node function json data, "Flags" is read using json_get_int_value_for_key(), resulting in 4-bytes being written into an "unsigned char flags" variable on the stack, overwriting 3-bytes of stack memory following it. On a big-endian system (e.g. Solaris-sparc or Linux for IBM Z), this causes regression test "013.watchdog_failover_require_consensus" to fail, since 0 is written into Flags, rather than the intended value which is in the least significant byte of the int value written.

Bug reported in:
https://www.pgpool.net/mantisbt/view.php?id=596

Patch author:
Greg Nancarrow (Fujitsu Australia)

Branch
------
V4_1_STABLE

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=a558287aa0fc9149002c3f4a20e8a82b32c04536

Modified Files
--------------
src/watchdog/wd_json_data.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)



More information about the pgpool-committers mailing list