This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: sqlite3 doesn't complain if the request contains a null character
Type: behavior Stage: resolved
Components: Extension Modules Versions: Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: ghaering, python-dev, serhiy.storchaka, vstinner
Priority: normal Keywords: patch

Created on 2014-04-03 17:07 by vstinner, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
sqlite_null.patch vstinner, 2014-04-09 00:23 review
sqlite_null_2.patch serhiy.storchaka, 2014-09-09 17:57 review
Messages (7)
msg215459 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-04-03 17:07
>>> import sqlite3
>>> c=sqlite3.connect(":memory:")
>>> c.execute("select 1")
<sqlite3.Cursor object at 0x7fd11e6a9110>
>>> c.execute("select 1").fetchall()
[(1,)]
>>> c.execute("\0select 1").fetchall()
[]
msg215785 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-04-09 00:23
Here is a first patch. I only tested the execute() method.
msg226416 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-09-05 10:02
Added a comment on Rietveld.
msg226648 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-09-09 17:57
Here is revised patch. There is yet one way to create Statement instance (Connection.__call__) and this patch covers it too.
msg226720 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-09-10 21:20
sqlite_null_2.patch looks good to me.
msg226760 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-09-11 10:33
New changeset 430865e9ea9f by Serhiy Storchaka in branch '2.7':
Issue #21147: sqlite3 now raises an exception if the request contains a null
http://hg.python.org/cpython/rev/430865e9ea9f

New changeset 517f216d45ea by Serhiy Storchaka in branch '3.4':
Issue #21147: sqlite3 now raises an exception if the request contains a null
http://hg.python.org/cpython/rev/517f216d45ea

New changeset b81f5652c2d7 by Serhiy Storchaka in branch 'default':
Issue #21147: sqlite3 now raises an exception if the request contains a null
http://hg.python.org/cpython/rev/b81f5652c2d7
msg282301 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-12-03 20:01
New changeset e358aaf9563f by Benjamin Peterson in branch '2.7':
fix refleak in null-containing error case (#21147)
https://hg.python.org/cpython/rev/e358aaf9563f
History
Date User Action Args
2022-04-11 14:58:01adminsetgithub: 65346
2016-12-03 20:01:38python-devsetmessages: + msg282301
2014-09-11 18:47:07serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2014-09-11 10:33:39python-devsetnosy: + python-dev
messages: + msg226760
2014-09-10 21:20:14vstinnersetmessages: + msg226720
2014-09-09 17:57:08serhiy.storchakasetfiles: + sqlite_null_2.patch

messages: + msg226648
stage: needs patch -> patch review
2014-09-05 10:02:58serhiy.storchakasettype: behavior
components: + Extension Modules
versions: + Python 2.7, Python 3.4
nosy: + serhiy.storchaka

messages: + msg226416
stage: needs patch
2014-04-09 00:23:49vstinnersetfiles: + sqlite_null.patch

nosy: + ghaering
messages: + msg215785

keywords: + patch
2014-04-03 17:07:25vstinnercreate