Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit ba00c98

Browse files
committed
Modification so a format error can be detected.
1 parent 4cb9c07 commit ba00c98

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/oidcmsg/message.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,11 @@ def from_urlencoded(self, urlencoded, **kwargs):
195195

196196
_spec = self.c_param
197197

198-
for key, val in parse_qs(urlencoded).items():
198+
_info = parse_qs(urlencoded)
199+
if len(urlencoded) and _info == {}:
200+
raise FormatError('Wrong format')
201+
202+
for key, val in _info.items():
199203
try:
200204
(typ, _, _, _deser, null_allowed) = _spec[key]
201205
except KeyError:
@@ -460,7 +464,10 @@ def from_json(self, txt, **kwargs):
460464
try:
461465
_dict = json.loads(txt)
462466
except TypeError:
463-
_dict = json.loads(as_unicode(txt))
467+
try:
468+
_dict = json.loads(as_unicode(txt))
469+
except TypeError:
470+
raise FormatError('Wrong format')
464471

465472
return self.from_dict(_dict)
466473

0 commit comments

Comments
 (0)