diff options
| author | Pip Cet | 2025-05-28 14:11:07 +0000 |
|---|---|---|
| committer | Pip Cet | 2025-05-28 19:22:57 +0000 |
| commit | d14fc6b75f128ed538c123ec79bd3d955ca9bf70 (patch) | |
| tree | 5434a330405fb3bd2b7e21e83995e850111ee82e /test/src | |
| parent | 295f73d23d337593959ec7d73ecbcfa61a732f0f (diff) | |
| download | emacs-d14fc6b75f128ed538c123ec79bd3d955ca9bf70.tar.gz emacs-d14fc6b75f128ed538c123ec79bd3d955ca9bf70.zip | |
Fix unsafe SDATA usage in print.c (bug#78590)
* src/print.c (print_string_1): Renamed from 'print_string', with an
extra argument to disable nonascii escaping.
(print_string): New function.
(print_object): Use 'print_string_1', not 'strout'.
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/print-tests.el | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/src/print-tests.el b/test/src/print-tests.el index af57311135b..036248fd091 100644 --- a/test/src/print-tests.el +++ b/test/src/print-tests.el | |||
| @@ -540,5 +540,23 @@ otherwise, use a different charset." | |||
| 540 | (should (eq callback-buffer buffer)) | 540 | (should (eq callback-buffer buffer)) |
| 541 | (should (equal str "tata")))) | 541 | (should (equal str "tata")))) |
| 542 | 542 | ||
| 543 | (ert-deftest test-print-number-realloc () | ||
| 544 | ;; Test for bug#78590. Note that this may in rare cases crash unfixed | ||
| 545 | ;; Emacs versions. | ||
| 546 | (let ((print-circle t) | ||
| 547 | (print-number-table (make-hash-table)) | ||
| 548 | (print-continuous-numbering t) | ||
| 549 | (str "yy") | ||
| 550 | (outstr "")) | ||
| 551 | (garbage-collect) | ||
| 552 | (ignore (make-string 100 ?a)) | ||
| 553 | (puthash str (make-string 3 ?x) print-number-table) | ||
| 554 | (prin1 str | ||
| 555 | (lambda (c) | ||
| 556 | (setq outstr (concat outstr (string c))) | ||
| 557 | (garbage-collect) | ||
| 558 | (ignore (make-string 100 ?b)))) | ||
| 559 | (should (equal outstr "xxx")))) | ||
| 560 | |||
| 543 | (provide 'print-tests) | 561 | (provide 'print-tests) |
| 544 | ;;; print-tests.el ends here | 562 | ;;; print-tests.el ends here |