diff options
| author | Noam Postavsky | 2017-06-07 19:59:09 -0400 |
|---|---|---|
| committer | Noam Postavsky | 2017-07-22 08:47:31 -0400 |
| commit | 8b18911a5c7c6c8a15b3cff12a4376ba68205e1c (patch) | |
| tree | 87354ab39568fb3162761b578bbdd70035e3b727 /src | |
| parent | 37954f39168e0dbfe3a82feb9b58fecfc5f1f318 (diff) | |
| download | emacs-8b18911a5c7c6c8a15b3cff12a4376ba68205e1c.tar.gz emacs-8b18911a5c7c6c8a15b3cff12a4376ba68205e1c.zip | |
Signal error for symbol names with strange quotes (Bug#2967)
* src/lread.c (read1): Signal an error when a symbol starts with a
non-escaped quote-like character.
* test/src/lread-tests.el (lread-tests--funny-quote-symbols): New
test.
* etc/NEWS: Announce change.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lread.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/lread.c b/src/lread.c index 901e40b3489..dbaadce4b40 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -3479,6 +3479,24 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3479 | if (! NILP (result)) | 3479 | if (! NILP (result)) |
| 3480 | return unbind_to (count, result); | 3480 | return unbind_to (count, result); |
| 3481 | } | 3481 | } |
| 3482 | if (!quoted && multibyte) | ||
| 3483 | { | ||
| 3484 | int ch = STRING_CHAR ((unsigned char *) read_buffer); | ||
| 3485 | switch (ch) | ||
| 3486 | { | ||
| 3487 | case 0x2018: /* LEFT SINGLE QUOTATION MARK */ | ||
| 3488 | case 0x2019: /* RIGHT SINGLE QUOTATION MARK */ | ||
| 3489 | case 0x201B: /* SINGLE HIGH-REVERSED-9 QUOTATION MARK */ | ||
| 3490 | case 0x201C: /* LEFT DOUBLE QUOTATION MARK */ | ||
| 3491 | case 0x201D: /* RIGHT DOUBLE QUOTATION MARK */ | ||
| 3492 | case 0x201F: /* DOUBLE HIGH-REVERSED-9 QUOTATION MARK */ | ||
| 3493 | case 0x301E: /* DOUBLE PRIME QUOTATION MARK */ | ||
| 3494 | case 0xFF02: /* FULLWIDTH QUOTATION MARK */ | ||
| 3495 | case 0xFF07: /* FULLWIDTH APOSTROPHE */ | ||
| 3496 | xsignal2 (Qinvalid_read_syntax, build_string ("strange quote"), | ||
| 3497 | CALLN (Fstring, make_number (ch))); | ||
| 3498 | } | ||
| 3499 | } | ||
| 3482 | { | 3500 | { |
| 3483 | Lisp_Object result; | 3501 | Lisp_Object result; |
| 3484 | ptrdiff_t nbytes = p - read_buffer; | 3502 | ptrdiff_t nbytes = p - read_buffer; |