mirror of
https://github.com/DBD-SQLite/DBD-SQLite
synced 2025-06-07 14:19:10 -04:00
DBD-SQLite: fixed the perl 5.8 segfault issue for set_authorizer
This commit is contained in:
parent
0db63f3f9e
commit
4f5603f3db
2 changed files with 27 additions and 8 deletions
30
dbdimp.c
30
dbdimp.c
|
@ -1521,10 +1521,32 @@ sqlite_db_authorizer_dispatcher (
|
|||
PUSHMARK(SP);
|
||||
|
||||
XPUSHs( sv_2mortal ( newSViv ( action_code ) ) );
|
||||
XPUSHs( sv_2mortal ( newSVpv ( details_1, 0 ) ) );
|
||||
XPUSHs( sv_2mortal ( newSVpv ( details_2, 0 ) ) );
|
||||
XPUSHs( sv_2mortal ( newSVpv ( details_3, 0 ) ) );
|
||||
XPUSHs( sv_2mortal ( newSVpv ( details_4, 0 ) ) );
|
||||
|
||||
/* these ifs are ugly but without them, perl 5.8 segfaults */
|
||||
if (details_1 == NULL) {
|
||||
XPUSHs( NULL );
|
||||
}
|
||||
else {
|
||||
XPUSHs( sv_2mortal ( newSVpv ( details_1, 0 ) ) );
|
||||
}
|
||||
if (details_2 == NULL) {
|
||||
XPUSHs( NULL );
|
||||
}
|
||||
else {
|
||||
XPUSHs( sv_2mortal ( newSVpv ( details_2, 0 ) ) );
|
||||
}
|
||||
if (details_3 == NULL) {
|
||||
XPUSHs( NULL );
|
||||
}
|
||||
else {
|
||||
XPUSHs( sv_2mortal ( newSVpv ( details_3, 0 ) ) );
|
||||
}
|
||||
if (details_4 == NULL) {
|
||||
XPUSHs( NULL );
|
||||
}
|
||||
else {
|
||||
XPUSHs( sv_2mortal ( newSVpv ( details_4, 0 ) ) );
|
||||
}
|
||||
PUTBACK;
|
||||
|
||||
n_retval = call_sv(authorizer, G_SCALAR);
|
||||
|
|
|
@ -112,10 +112,7 @@ foreach my $call_func (@CALL_FUNCS) {
|
|||
: DBD::SQLite::OK;
|
||||
return $retval;
|
||||
};
|
||||
unless ($] < 5.010) {
|
||||
# FIXME: this line may cause segfalut
|
||||
$dbh->$call_func($authorizer, "set_authorizer");
|
||||
}
|
||||
$dbh->$call_func($authorizer, "set_authorizer");
|
||||
|
||||
# try an insert (should be authorized) and check authorizer args
|
||||
$dbh->do("INSERT INTO hook_test VALUES ('auth_test')");
|
||||
|
|
Loading…
Add table
Reference in a new issue