]> git.eshelyaron.com Git - emacs.git/commitdiff
Protect against invalid punycode
authorLars Ingebrigtsen <larsi@gnus.org>
Sun, 20 Oct 2019 07:40:11 +0000 (09:40 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Sun, 20 Oct 2019 07:40:11 +0000 (09:40 +0200)
* lisp/net/puny.el (puny-decode-string): Protect against invalid
punycode.

lisp/net/puny.el

index 23c7af806193e47c19f94a36d51feb5c87d8f8d7..729076ddbd74c5b925fa2ac2636fc7dd91ad15df 100644 (file)
@@ -63,7 +63,10 @@ For instance, \"xn--ff-2sa.org\" => \"fśf.org\"."
   "Decode an IDNA/punycode-encoded string.
 For instance \"xn--bcher-kva\" => \"bücher\"."
   (if (string-match "\\`xn--" string)
-      (puny-decode-string-internal (substring string 4))
+      (condition-case nil
+          (puny-decode-string-internal (substring string 4))
+        ;; If the string is invalid Punycode, just return the string.
+        (args-out-of-range string))
     string))
 
 (defconst puny-initial-n 128)