| From: | Andres Freund <andres(at)anarazel(dot)de> |
|---|---|
| To: | Ilya Cherdakov <i(dot)cherdakov(dot)pg(at)gmail(dot)com> |
| Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, drowley(at)postgresql(dot)org |
| Subject: | Re: Assert in test_bms_membership(); |
| Date: | 2026-09-08 13:14:03 |
| Message-ID: | xtnukvzkuhsyjvre57ujzmtydmtkyhru3w22zyimdicxtkvc4j@ehar7n6yackd |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
On 2026-09-08 18:52:58 +0700, Ilya Cherdakov wrote:
> Postgresql 19 added a new module, src/test/modules/test_bitmapset.
> It contains the function test_bms_membership(), which is a wrapper
> around bms_membership. Passing some string that are not valid Bitmapset
> representation to this function will result to assert. For example
>
> SELECT test_bms_membership('b 1 2)');
> or
> SELECT test_bms_membership('true');
>
> [backtrace.txt]
>
> |The assertion appears to occur becaus| in
> #define TEXT_TO_BITMAPSET(str) (test_bitmapset.c:91) casts to Bitmapset*
> without type checking, using stringToNode, which obviously can return
> types other than T_Bitmapset (read.c:247). This pointer, with the wrong
> type, is then passed to bms_membership, where it fails the assert
> with type checking (bitmapset.c:905).
>
> The fix simply adds a check whether the type is valid or not,
> as done in the bms_is_valid_set()(bitmapset.c:87) function.
Perhaps a stupid question, but: Who cares? This is a test module, intended to
write tests for bms_*. I feel like we have much better things to do than to
prevent somebody triggering asserts while write tests in an intentionally bad
way?
Greetings,
Andres Freund
| From | Date | Subject | |
|---|---|---|---|
| Next Message | torikoshia | 2026-09-08 13:17:13 | Re: RFC: Logging plan of the running query |
| Previous Message | Marco Nenciarini | 2026-09-08 13:13:45 | Re: pg_upgrade_replica: avoid full re-clone of standbys after pg_upgrade |