pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #18848: DEREF_AFTER_NULL.EX.COND After having been compared to a NULL
2+ messages / 2 participants
[nested] [flat]
* BUG #18848: DEREF_AFTER_NULL.EX.COND After having been compared to a NULL
@ 2025-03-14 09:12 PG Bug reporting form <noreply@postgresql.org>
2025-03-14 14:27 ` Re: BUG #18848: DEREF_AFTER_NULL.EX.COND After having been compared to a NULL Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 2+ messages in thread
From: PG Bug reporting form @ 2025-03-14 09:12 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: pm91.arapov@gmail.com
The following bug has been logged on the website:
Bug reference: 18848
Logged by: Nikita
Email address: pm91.arapov@gmail.com
PostgreSQL version: 16.6
Operating system: ubuntu 20.04
Description:
Looks like there is inconsistency with 'ind_name' and 'int_type' checks. In
one place both are checked. In other place only the second one is checked.
It's possible that when the second is not NULL the first is also not NULL.
If this is so then the problem is not real. But it's hard to prove this. In
any case the code needs to be made more clear.
diff --git a/src/interfaces/ecpg/preproc/type.c
b/src/interfaces/ecpg/preproc/type.c
--- a/src/interfaces/ecpg/preproc/type.c (revision
a49ac80219c6f28c3cf3973f797de637329952da)
+++ b/src/interfaces/ecpg/preproc/type.c (date 1740396929346)
@@ -395,7 +395,10 @@
ECPGdump_a_simple(o, name, type->type, type->size, (arr_str_size &&
strcmp(arr_str_size, "0") != 0) ? arr_str_size : str_neg_one, struct_sizeof,
prefix, type->counter);
if (ind_type != NULL)
- ECPGdump_a_simple(o, ind_name, ind_type->type, ind_type->size,
(arr_str_size && strcmp(arr_str_size, "0") != 0) ? arr_str_size :
ind_type_neg_one, ind_struct_sizeof, ind_prefix, 0);
+ {
+ Assert(ind_name != NULL);
+ ECPGdump_a_simple(o, ind_name, ind_type->type,
ind_type->size, (arr_str_size && strcmp(arr_str_size, "0") != 0) ?
arr_str_size : ind_type_neg_one, ind_struct_sizeof, ind_prefix, 0);
+ }
free(str_neg_one);
free(ind_type_neg_one);
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #18848: DEREF_AFTER_NULL.EX.COND After having been compared to a NULL
2025-03-14 09:12 BUG #18848: DEREF_AFTER_NULL.EX.COND After having been compared to a NULL PG Bug reporting form <noreply@postgresql.org>
@ 2025-03-14 14:27 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2025-03-14 14:27 UTC (permalink / raw)
To: pm91.arapov@gmail.com; +Cc: pgsql-bugs@lists.postgresql.org
PG Bug reporting form <noreply@postgresql.org> writes:
> Looks like there is inconsistency with 'ind_name' and 'int_type' checks. In
> one place both are checked. In other place only the second one is checked.
> It's possible that when the second is not NULL the first is also not NULL.
> If this is so then the problem is not real. But it's hard to prove this. In
> any case the code needs to be made more clear.
Perhaps it needs to be made more clear, but this patch seems like no
improvement. Adding that Assert accomplishes nothing --- the code
will dump core if ind_name is null, with or without an Assert.
Given the lack of field complaints, I'm inclined to believe there's
not a bug here.
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2025-03-14 14:27 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-03-14 09:12 BUG #18848: DEREF_AFTER_NULL.EX.COND After having been compared to a NULL PG Bug reporting form <noreply@postgresql.org>
2025-03-14 14:27 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox