Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit18404ea

Browse files
Fix segmentation fault in test_tidstore.
The do_set_block_offsets() and other functions accessing the tidstoredid not check if the tidstore was NULL. This led to a segmentationfault when these functions are called without calling thetest_create().This commit adds NULL checks in relevant functions of test_tidstore toraise an error instead if the tidstore is not initialized.Bug: #18483Reported-by: Alexander KozhemyakinReviewed-by: Michael PaquierDiscussion:https://postgr.es/m/18483-30bfff42de238000%40postgresql.org
1 parent915de70 commit18404ea

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

‎src/test/modules/test_tidstore/test_tidstore.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,13 @@ sanity_check_array(ArrayType *ta)
146146
errmsg("argument must be empty or one-dimensional array")));
147147
}
148148

149+
staticvoid
150+
check_tidstore_available(void)
151+
{
152+
if (tidstore==NULL)
153+
elog(ERROR,"tidstore is not created");
154+
}
155+
149156
staticvoid
150157
purge_from_verification_array(BlockNumberblkno)
151158
{
@@ -167,6 +174,7 @@ do_set_block_offsets(PG_FUNCTION_ARGS)
167174
OffsetNumber*offs;
168175
intnoffs;
169176

177+
check_tidstore_available();
170178
sanity_check_array(ta);
171179

172180
noffs=ArrayGetNItems(ARR_NDIM(ta),ARR_DIMS(ta));
@@ -217,6 +225,8 @@ check_set_block_offsets(PG_FUNCTION_ARGS)
217225
intnum_lookup_tids=0;
218226
BlockNumberprevblkno=0;
219227

228+
check_tidstore_available();
229+
220230
/* lookup each member in the verification array */
221231
for (inti=0;i<items.num_tids;i++)
222232
if (!TidStoreIsMember(tidstore,&items.insert_tids[i]))
@@ -305,6 +315,8 @@ test_is_full(PG_FUNCTION_ARGS)
305315
{
306316
boolis_full;
307317

318+
check_tidstore_available();
319+
308320
is_full= (TidStoreMemoryUsage(tidstore)>tidstore_empty_size);
309321

310322
PG_RETURN_BOOL(is_full);
@@ -314,6 +326,8 @@ test_is_full(PG_FUNCTION_ARGS)
314326
Datum
315327
test_destroy(PG_FUNCTION_ARGS)
316328
{
329+
check_tidstore_available();
330+
317331
TidStoreDestroy(tidstore);
318332
tidstore=NULL;
319333
items.num_tids=0;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp