• R/O
  • SSH
  • HTTPS

yash: 提交


Commit MetaInfo

修訂4187 (tree)
時間2022-07-24 12:30:41
作者magicant

Log Message

Correct assertion in here-doc delimiter parsing (#45202)

If is_end_of_heredoc_contents is called immediately after parsing
another here-doc delimiter that is not followed by a newline, the
assertion does not hold.

Change Summary

差異

--- yash/trunk/parser.c (revision 4186)
+++ yash/trunk/parser.c (revision 4187)
@@ -1,6 +1,6 @@
11 /* Yash: yet another shell */
22 /* parser.c: syntax parser */
3-/* (C) 2007-2021 magicant */
3+/* (C) 2007-2022 magicant */
44
55 /* This program is free software: you can redistribute it and/or modify
66 * it under the terms of the GNU General Public License as published by
@@ -3233,11 +3233,12 @@
32333233 bool is_end_of_heredoc_contents(
32343234 parsestate_T *ps, const wchar_t *eoc, bool skiptab)
32353235 {
3236- assert(ps->src.length > 0 && ps->src.contents[ps->index - 1] == L'\n');
3237-
32383236 if (ps->src.contents[ps->index] == L'\0')
32393237 if (read_more_input(ps) != INPUT_OK)
32403238 return false;
3239+
3240+ assert(ps->src.length > 0 && ps->src.contents[ps->index - 1] == L'\n');
3241+
32413242 if (skiptab)
32423243 while (ps->src.contents[ps->index] == L'\t')
32433244 ps->index++;
Show on old repository browser