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

Commit465ed56

Browse files
committed
Fix core dump when pltcl_elog is called with wrong number of parameters,
per report from Ian Harding.
1 parente24977f commit465ed56

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

‎src/pl/tcl/pltcl.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* ENHANCEMENTS, OR MODIFICATIONS.
3232
*
3333
* IDENTIFICATION
34-
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.68 2002/12/30 22:10:54 tgl Exp $
34+
* $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.69 2003/02/06 17:02:11 tgl Exp $
3535
*
3636
**********************************************************************/
3737

@@ -1255,7 +1255,7 @@ static int
12551255
pltcl_elog(ClientDatacdata,Tcl_Interp*interp,
12561256
intargc,CONST84char*argv[])
12571257
{
1258-
intlevel;
1258+
volatileintlevel;
12591259
sigjmp_bufsave_restart;
12601260

12611261
/************************************************************
@@ -1264,18 +1264,6 @@ pltcl_elog(ClientData cdata, Tcl_Interp *interp,
12641264
if (pltcl_restart_in_progress)
12651265
returnTCL_ERROR;
12661266

1267-
/************************************************************
1268-
* Catch the restart longjmp and begin a controlled
1269-
* return though all interpreter levels if it happens
1270-
************************************************************/
1271-
memcpy(&save_restart,&Warn_restart,sizeof(save_restart));
1272-
if (sigsetjmp(Warn_restart,1)!=0)
1273-
{
1274-
memcpy(&Warn_restart,&save_restart,sizeof(Warn_restart));
1275-
pltcl_restart_in_progress=1;
1276-
returnTCL_ERROR;
1277-
}
1278-
12791267
if (argc!=3)
12801268
{
12811269
Tcl_SetResult(interp,"syntax error - 'elog level msg'",
@@ -1301,17 +1289,29 @@ pltcl_elog(ClientData cdata, Tcl_Interp *interp,
13011289
{
13021290
Tcl_AppendResult(interp,"Unknown elog level '",argv[1],
13031291
"'",NULL);
1292+
returnTCL_ERROR;
1293+
}
1294+
1295+
/************************************************************
1296+
* Catch the longjmp from elog() and begin a controlled
1297+
* return though all interpreter levels if it happens
1298+
************************************************************/
1299+
memcpy(&save_restart,&Warn_restart,sizeof(save_restart));
1300+
if (sigsetjmp(Warn_restart,1)!=0)
1301+
{
13041302
memcpy(&Warn_restart,&save_restart,sizeof(Warn_restart));
1303+
pltcl_restart_in_progress=1;
13051304
returnTCL_ERROR;
13061305
}
13071306

13081307
/************************************************************
13091308
* Call elog(), restore the original restart address
1310-
* and return to the caller (ifnot catched)
1309+
* and return to the caller (ifno longjmp)
13111310
************************************************************/
13121311
UTF_BEGIN;
13131312
elog(level,"%s",UTF_U2E(argv[2]));
13141313
UTF_END;
1314+
13151315
memcpy(&Warn_restart,&save_restart,sizeof(Warn_restart));
13161316
returnTCL_OK;
13171317
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp