Skip to content

Commit

Permalink
Fix a NULL profile dereference in dbi_profile()
Browse files Browse the repository at this point in the history
hv_fetch() documentation requires checking for NULL and the code does
that. But then calls SvOK(profile) uncoditionally two lines later.
This patch fixes it.
  • Loading branch information
ppisar committed Jul 31, 2019
1 parent a0e1755 commit eca7d7c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions DBI.xs
Original file line number Diff line number Diff line change
Expand Up @@ -2888,8 +2888,12 @@ dbi_profile(SV *h, imp_xxh_t *imp_xxh, SV *statement_sv, SV *method, NV t1, NV t
mg_get(profile); /* FETCH */
if (!profile || !SvROK(profile)) {
DBIc_set(imp_xxh, DBIcf_Profile, 0); /* disable */
if (SvOK(profile) && !PL_dirty)
warn("Profile attribute isn't a hash ref (%s,%ld)", neatsvpv(profile,0), (long)SvTYPE(profile));
if (!PL_dirty) {
if (!profile)
warn("Profile attribute does not exist");
else if (SvOK(profile))
warn("Profile attribute isn't a hash ref (%s,%ld)", neatsvpv(profile,0), (long)SvTYPE(profile));
}
return &PL_sv_undef;
}

Expand Down

0 comments on commit eca7d7c

Please # to comment.