Mercurial > hg > xemacs-beta
comparison src/lread.c @ 4483:7869173584fc
Error on over-long hex character escapes.
2008-07-16 Aidan Kehoe <kehoea@parhasard.net>
* lread.c (read_escape):
Error if we're handed an over-long hex character escape, something
which arises reasonably frequently in code written for GNU.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Wed, 16 Jul 2008 22:36:03 +0200 |
parents | ac6231e0c1df |
children | 1e3cf11fa27d |
comparison
equal
deleted
inserted
replaced
4478:ec442dc06fe1 | 4483:7869173584fc |
---|---|
1853 { | 1853 { |
1854 unreadchar (readcharfun, c); | 1854 unreadchar (readcharfun, c); |
1855 break; | 1855 break; |
1856 } | 1856 } |
1857 } | 1857 } |
1858 | |
1859 if (count == 3) | |
1860 { | |
1861 c = readchar (readcharfun); | |
1862 if ((c >= '0' && c <= '9') || | |
1863 (c >= 'a' && c <= 'f') || | |
1864 (c >= 'A' && c <= 'F')) | |
1865 { | |
1866 Lisp_Object args[2]; | |
1867 | |
1868 if (c >= '0' && c <= '9') i = (i << 4) + (c - '0'); | |
1869 else if (c >= 'a' && c <= 'f') i = (i << 4) + (c - 'a') + 10; | |
1870 else if (c >= 'A' && c <= 'F') i = (i << 4) + (c - 'A') + 10; | |
1871 | |
1872 args[0] = build_string ("?\\x%x"); | |
1873 args[1] = make_int (i); | |
1874 syntax_error ("Overlong hex character escape", | |
1875 Fformat (2, args)); | |
1876 } | |
1877 unreadchar (readcharfun, c); | |
1878 } | |
1879 | |
1858 return i; | 1880 return i; |
1859 } | 1881 } |
1860 case 'U': | 1882 case 'U': |
1861 /* Post-Unicode-2.0: Up to eight hex chars */ | 1883 /* Post-Unicode-2.0: Up to eight hex chars */ |
1862 return read_unicode_escape(readcharfun, 8); | 1884 return read_unicode_escape(readcharfun, 8); |