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

Commitbda1a92

Browse files
committed
Fixed segmentation fault in the dictionary lookup (messing with pointers
in the shared segment while reloading affixes).
1 parent33508c8 commitbda1a92

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

‎src/shared_ispell.c‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,8 @@ void init_shared_dict(DictInfo * info, char * dictFile, char * affFile, char * s
335335

336336
/* load the dictionary / affixes if not yet defined */
337337
if (shdict==NULL) {
338+
339+
elog(WARNING,"shdict not found");
338340

339341
dict= (IspellDict*)palloc0(sizeof(IspellDict));
340342

@@ -369,8 +371,10 @@ void init_shared_dict(DictInfo * info, char * dictFile, char * affFile, char * s
369371

370372
}else {
371373

374+
/* local copy, so that we can change the pointers */
375+
SharedIspellDict*shdict_local=NULL;
376+
372377
/* we got the dictionary, but we need to reload the affixes (to handle regex_t rules) */
373-
374378
dict= (IspellDict*)palloc0(sizeof(IspellDict));
375379

376380
NIStartBuild(dict);
@@ -386,6 +390,14 @@ void init_shared_dict(DictInfo * info, char * dictFile, char * affFile, char * s
386390

387391
NIFinishBuild(dict);
388392

393+
/* now, we need to create a local copy of the shared dictionary, so that we can modify the
394+
* pointers locally (without breaking the other backends) */
395+
shdict_local= (SharedIspellDict*)palloc(sizeof(SharedIspellDict));
396+
memcpy(shdict_local,shdict,sizeof(SharedIspellDict));
397+
398+
/* keep the local only */
399+
shdict=shdict_local;
400+
389401
shdict->Suffix=dict->Suffix;
390402
shdict->Prefix=dict->Prefix;
391403

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp