Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
f8052767
Commit
f8052767
authored
Oct 08, 2008
by
Gerhard Häring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #4046: Backport of issue #3312's patch: fixes two crashes in the sqlite3
module.
parent
bab0f2ff
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
3 deletions
+16
-3
Misc/NEWS
Misc/NEWS
+3
-0
Modules/_sqlite/connection.c
Modules/_sqlite/connection.c
+9
-2
Modules/_sqlite/module.c
Modules/_sqlite/module.c
+4
-1
No files found.
Misc/NEWS
View file @
f8052767
...
...
@@ -215,6 +215,9 @@ Extension Modules
-
Issue
#
1471
:
Arguments
to
fcntl
.
ioctl
are
no
longer
broken
on
64
-
bit
OpenBSD
and
similar
platforms
due
to
sign
extension
.
-
Issue
#
3312
:
Fix
two
crashes
in
sqlite3
.
Tests
-----
...
...
Modules/_sqlite/connection.c
View file @
f8052767
...
...
@@ -822,6 +822,7 @@ static int connection_set_isolation_level(Connection* self, PyObject* isolation_
{
PyObject
*
res
;
PyObject
*
begin_statement
;
char
*
begin_statement_str
;
Py_XDECREF
(
self
->
isolation_level
);
...
...
@@ -854,12 +855,18 @@ static int connection_set_isolation_level(Connection* self, PyObject* isolation_
return
-
1
;
}
self
->
begin_statement
=
PyMem_Malloc
(
PyString_Size
(
begin_statement
)
+
2
);
begin_statement_str
=
PyString_AsString
(
begin_statement
);
if
(
!
begin_statement_str
)
{
Py_DECREF
(
begin_statement
);
return
-
1
;
}
self
->
begin_statement
=
PyMem_Malloc
(
strlen
(
begin_statement_str
)
+
2
);
if
(
!
self
->
begin_statement
)
{
Py_DECREF
(
begin_statement
);
return
-
1
;
}
strcpy
(
self
->
begin_statement
,
PyString_AsString
(
begin_statement
)
);
strcpy
(
self
->
begin_statement
,
begin_statement_str
);
Py_DECREF
(
begin_statement
);
}
...
...
Modules/_sqlite/module.c
View file @
f8052767
...
...
@@ -128,12 +128,15 @@ static PyObject* module_register_adapter(PyObject* self, PyObject* args, PyObjec
{
PyTypeObject
*
type
;
PyObject
*
caster
;
int
rc
;
if
(
!
PyArg_ParseTuple
(
args
,
"OO"
,
&
type
,
&
caster
))
{
return
NULL
;
}
microprotocols_add
(
type
,
(
PyObject
*
)
&
SQLitePrepareProtocolType
,
caster
);
rc
=
microprotocols_add
(
type
,
(
PyObject
*
)
&
SQLitePrepareProtocolType
,
caster
);
if
(
rc
==
-
1
)
return
NULL
;
Py_INCREF
(
Py_None
);
return
Py_None
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment