File tree Expand file tree Collapse file tree 5 files changed +45
-7
lines changed
Expand file tree Collapse file tree 5 files changed +45
-7
lines changed Original file line number Diff line number Diff line change 11Bleach changes
22==============
33
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+
419Version 3.2.2 (January 20th, 2021)
5- ------------------------------------
20+ ----------------------------------
621
722**Security fixes**
823
Original file line number Diff line number Diff line change 1818
1919
2020# yyyymmdd
21- __releasedate__ = "20210120 "
21+ __releasedate__ = "20210126 "
2222# x.y.z or x.y.z.dev0 -- semver
23- __version__ = "3.2.2 "
23+ __version__ = "3.2.3 "
2424VERSION = packaging .version .Version (__version__ )
2525
2626
Original file line number Diff line number Diff line change @@ -459,9 +459,22 @@ def convert_entity(value):
459459 if value [0 ] == "#" :
460460 if len (value ) < 2 :
461461 return None
462+
462463 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
465478
466479 return ENTITIES .get (value , None )
467480
Original file line number Diff line number Diff line change 1919 ("&xx;" , "&xx;" ),
2020 # Handles multiple entities in the same string
2121 ("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;" ),
2232 ],
2333)
2434def test_convert_entities (data , expected ):
Original file line number Diff line number Diff line change 22< html >
33 < head >
44 < meta charset ="UTF-8 ">
5- < title > Python Bleach 3.2.2 </ title >
5+ < title > Python Bleach 3.2.3 </ title >
66 < style >
77 textarea , iframe {
88 width : 95% ;
2020 </ style >
2121 </ head >
2222 < body >
23- < h2 > Python Bleach 3.2.2 </ h2 >
23+ < h2 > Python Bleach 3.2.3 </ h2 >
2424 < p >
2525 < 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 >
2626 < 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