File tree 5 files changed +45
-7
lines changed
5 files changed +45
-7
lines changed Original file line number Diff line number Diff line change 1
1
Bleach changes
2
2
==============
3
3
4
+ Version 3.2.3 (January 26th, 2021)
5
+ ----------------------------------
6
+
7
+ **Security fixes**
8
+
9
+ None
10
+
11
+ **Features**
12
+
13
+ None
14
+
15
+ **Bug fixes**
16
+
17
+ * fix clean and linkify raising ValueErrors for certain inputs. Thank you @Google-Autofuzz.
18
+
4
19
Version 3.2.2 (January 20th, 2021)
5
- ------------------------------------
20
+ ----------------------------------
6
21
7
22
**Security fixes**
8
23
Original file line number Diff line number Diff line change 18
18
19
19
20
20
# yyyymmdd
21
- __releasedate__ = "20210120 "
21
+ __releasedate__ = "20210126 "
22
22
# x.y.z or x.y.z.dev0 -- semver
23
- __version__ = "3.2.2 "
23
+ __version__ = "3.2.3 "
24
24
VERSION = packaging .version .Version (__version__ )
25
25
26
26
Original file line number Diff line number Diff line change @@ -459,9 +459,22 @@ def convert_entity(value):
459
459
if value [0 ] == "#" :
460
460
if len (value ) < 2 :
461
461
return None
462
+
462
463
if value [1 ] in ("x" , "X" ):
463
- return six .unichr (int (value [2 :], 16 ))
464
- return six .unichr (int (value [1 :], 10 ))
464
+ # hex-encoded code point
465
+ int_as_string , base = value [2 :], 16
466
+ else :
467
+ # decimal code point
468
+ int_as_string , base = value [1 :], 10
469
+
470
+ if int_as_string == "" :
471
+ return None
472
+
473
+ code_point = int (int_as_string , base )
474
+ if 0 < code_point < 0x110000 :
475
+ return six .unichr (code_point )
476
+ else :
477
+ return None
465
478
466
479
return ENTITIES .get (value , None )
467
480
Original file line number Diff line number Diff line change 19
19
("&xx;" , "&xx;" ),
20
20
# Handles multiple entities in the same string
21
21
("this & that & that" , "this & that & that" ),
22
+ # Handles empty decimal and hex encoded code points
23
+ ("&#x;" , "&#x;" ),
24
+ ("&#;" , "&#;" ),
25
+ # Handles too high unicode points
26
+ ("�" , "�" ),
27
+ ("�" , "�" ),
28
+ ("�" , "�" ),
29
+ # Handles negative unicode points
30
+ ("&#-1;" , "&#-1;" ),
31
+ ("&#x-1;" , "&#x-1;" ),
22
32
],
23
33
)
24
34
def test_convert_entities (data , expected ):
Original file line number Diff line number Diff line change 2
2
< html >
3
3
< head >
4
4
< meta charset ="UTF-8 ">
5
- < title > Python Bleach 3.2.2 </ title >
5
+ < title > Python Bleach 3.2.3 </ title >
6
6
< style >
7
7
textarea , iframe {
8
8
width : 95% ;
20
20
</ style >
21
21
</ head >
22
22
< body >
23
- < h2 > Python Bleach 3.2.2 </ h2 >
23
+ < h2 > Python Bleach 3.2.3 </ h2 >
24
24
< p >
25
25
< a href ="http://badge.fury.io/py/bleach "> < img style ="max-width:100%; " alt ="pypi version " src ="https://badge.fury.io/py/bleach.svg "> </ a >
26
26
< a href ="https://github.com/mozilla/bleach/actions?query=workflow%3ATest "> < img style ="max-width:100%; " alt ="Build Status " src ="https://github.com/mozilla/bleach/workflows/Test/badge.svg "> </ a >
You can’t perform that action at this time.
0 commit comments