Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
35466c5b
Kaydet (Commit)
35466c5b
authored
Nis 22, 2010
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #8195: Fix a crash in sqlite Connection.create_collation() if the
collation name contains a surrogate character.
üst
0c2d8b8e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
5 deletions
+22
-5
regression.py
Lib/sqlite3/test/regression.py
+7
-0
NEWS
Misc/NEWS
+3
-0
connection.c
Modules/_sqlite/connection.c
+12
-5
No files found.
Lib/sqlite3/test/regression.py
Dosyayı görüntüle @
35466c5b
...
@@ -274,6 +274,13 @@ class RegressionTests(unittest.TestCase):
...
@@ -274,6 +274,13 @@ class RegressionTests(unittest.TestCase):
"""
"""
self
.
assertRaises
(
sqlite
.
Warning
,
self
.
con
,
1
)
self
.
assertRaises
(
sqlite
.
Warning
,
self
.
con
,
1
)
def
CheckCollation
(
self
):
def
collation_cb
(
a
,
b
):
return
1
self
.
assertRaises
(
sqlite
.
ProgrammingError
,
self
.
con
.
create_collation
,
# Lone surrogate cannot be encoded to the default encoding (utf8)
"
\uDC80
"
,
collation_cb
)
def
suite
():
def
suite
():
regression_suite
=
unittest
.
makeSuite
(
RegressionTests
,
"Check"
)
regression_suite
=
unittest
.
makeSuite
(
RegressionTests
,
"Check"
)
return
unittest
.
TestSuite
((
regression_suite
,))
return
unittest
.
TestSuite
((
regression_suite
,))
...
...
Misc/NEWS
Dosyayı görüntüle @
35466c5b
...
@@ -323,6 +323,9 @@ C-API
...
@@ -323,6 +323,9 @@ C-API
Library
Library
-------
-------
- Issue #8195: Fix a crash in sqlite Connection.create_collation() if the
collation name contains a surrogate character.
- Issue #8484: Load all ciphers and digest algorithms when initializing
- Issue #8484: Load all ciphers and digest algorithms when initializing
the _ssl extension, such that verification of some SSL certificates
the _ssl extension, such that verification of some SSL certificates
doesn't fail because of an "unknown algorithm".
doesn't fail because of an "unknown algorithm".
...
...
Modules/_sqlite/connection.c
Dosyayı görüntüle @
35466c5b
...
@@ -1374,7 +1374,9 @@ pysqlite_connection_create_collation(pysqlite_Connection* self, PyObject* args)
...
@@ -1374,7 +1374,9 @@ pysqlite_connection_create_collation(pysqlite_Connection* self, PyObject* args)
PyObject
*
uppercase_name
=
0
;
PyObject
*
uppercase_name
=
0
;
PyObject
*
name
;
PyObject
*
name
;
PyObject
*
retval
;
PyObject
*
retval
;
char
*
chk
;
Py_UNICODE
*
chk
;
Py_ssize_t
i
,
len
;
char
*
uppercase_name_str
;
int
rc
;
int
rc
;
if
(
!
pysqlite_check_thread
(
self
)
||
!
pysqlite_check_connection
(
self
))
{
if
(
!
pysqlite_check_thread
(
self
)
||
!
pysqlite_check_connection
(
self
))
{
...
@@ -1390,19 +1392,24 @@ pysqlite_connection_create_collation(pysqlite_Connection* self, PyObject* args)
...
@@ -1390,19 +1392,24 @@ pysqlite_connection_create_collation(pysqlite_Connection* self, PyObject* args)
goto
finally
;
goto
finally
;
}
}
chk
=
_PyUnicode_AsString
(
uppercase_name
);
len
=
PyUnicode_GET_SIZE
(
uppercase_name
);
while
(
*
chk
)
{
chk
=
PyUnicode_AS_UNICODE
(
uppercase_name
);
for
(
i
=
0
;
i
<
len
;
i
++
,
chk
++
)
{
if
((
*
chk
>=
'0'
&&
*
chk
<=
'9'
)
if
((
*
chk
>=
'0'
&&
*
chk
<=
'9'
)
||
(
*
chk
>=
'A'
&&
*
chk
<=
'Z'
)
||
(
*
chk
>=
'A'
&&
*
chk
<=
'Z'
)
||
(
*
chk
==
'_'
))
||
(
*
chk
==
'_'
))
{
{
c
hk
++
;
c
ontinue
;
}
else
{
}
else
{
PyErr_SetString
(
pysqlite_ProgrammingError
,
"invalid character in collation name"
);
PyErr_SetString
(
pysqlite_ProgrammingError
,
"invalid character in collation name"
);
goto
finally
;
goto
finally
;
}
}
}
}
uppercase_name_str
=
_PyUnicode_AsString
(
uppercase_name
);
if
(
!
uppercase_name_str
)
goto
finally
;
if
(
callable
!=
Py_None
&&
!
PyCallable_Check
(
callable
))
{
if
(
callable
!=
Py_None
&&
!
PyCallable_Check
(
callable
))
{
PyErr_SetString
(
PyExc_TypeError
,
"parameter must be callable"
);
PyErr_SetString
(
PyExc_TypeError
,
"parameter must be callable"
);
goto
finally
;
goto
finally
;
...
@@ -1417,7 +1424,7 @@ pysqlite_connection_create_collation(pysqlite_Connection* self, PyObject* args)
...
@@ -1417,7 +1424,7 @@ pysqlite_connection_create_collation(pysqlite_Connection* self, PyObject* args)
}
}
rc
=
sqlite3_create_collation
(
self
->
db
,
rc
=
sqlite3_create_collation
(
self
->
db
,
_PyUnicode_AsString
(
uppercase_name
)
,
uppercase_name_str
,
SQLITE_UTF8
,
SQLITE_UTF8
,
(
callable
!=
Py_None
)
?
callable
:
NULL
,
(
callable
!=
Py_None
)
?
callable
:
NULL
,
(
callable
!=
Py_None
)
?
pysqlite_collation_callback
:
NULL
);
(
callable
!=
Py_None
)
?
pysqlite_collation_callback
:
NULL
);
...
...
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