82038[BUGFIX] Prevent endless loop in t3editor when using '/*' literal
Commit message
Review
-
Code review CR +2 Done
- Andreas Kienast +2
- Benjamin Franzke +1
- Garvin Hicking +1
-
Verified V +2 Done
- Andreas Kienast +2
- Benjamin Franzke +1
- Garvin Hicking +1
- Andreas Kalkhoff +1
- core-ci +1 CI
Issues 2
Files 2
Review log 1316
-
Garvin Hicking uploaded patch set 1 11/29/23, 14:49
-
Garvin Hicking commented on patch set 1 11/29/23, 14:54
This is the implementation of Andreas Kalkhoffs idea posted on typo3-cms slack, I'll quote his remark here: (...) looking at https://review.typo3.org/c/Packages/TYPO3.CMS/+/80852/2/Build/Sources/TypeScript/t3editor/stream-parser/typoscript.ts#1085 there's a small change to the function tokenComment(); I'd suspect that the null-check returns always true (given that "FALSE !== null" equals TRUE; though idk the return values of stream.next() ). I think going for != instead of !== might solve the issue. Please feel free to take over/abandon/change this patch as you like, I tried to do some legwork only. -
Andreas Kienast commented on patch set 1 CR -1 11/29/23, 14:55
typoscript.ts:1077I don't understand how this should solve the issue. It smells like `stream.next()` returns anything that's falsey, not just `null`. This requires more debugging. -
core-ci voted on patch set 1 V +1 11/29/23, 14:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50123
-
Andreas Kienast uploaded patch set 2
CR -1V +111/29/23, 15:04 -
Andreas Kienast commented on patch set 2 11/29/23, 15:04
typoscript.ts:1077ReplyDone -
core-ci voted on patch set 2 V +1 11/29/23, 15:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50124
-
Garvin Hicking commented on patch set 2 CR +1 V +1 11/29/23, 15:14
One scenario left open, if I enter a typoscript line like: someString = '/* just a string' someOtherString = 'yes' then the highlight-parser thinks the "/*" started a comment that goes on also for the next line (and remains unclosed), while in reality it's just part of a string. (Can't comment on whether this has always been misinterpreted? At least this behaviour is better than crashing the browser, so I'm all for it) -
Benjamin Franzke commented on patch set 2 CR -1 11/29/23, 15:16
thanks, good catch! will check (we've got other loops that look fishy as well) -
Andreas Kienast commented on patch set 2 11/29/23, 15:17
Reply
AFAICS that's a misbehavior caused by how the parser is implemented. It solely checks for matching tokens, ignoring the context a token was found in. -
Benjamin Franzke uploaded patch set 3
CR +1V +111/30/23, 07:44 -
core-ci voted on patch set 3 V +1 11/30/23, 07:51 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/50149
-
Garvin Hicking voted on patch set 3 CR +1 V +1 11/30/23, 08:10
-
Andreas Kalkhoff voted on patch set 3 V +1 11/30/23, 08:34
-
Andreas Kienast voted on patch set 3 CR +2 V +2 11/30/23, 08:36
-
Andreas Kienast merged patch set 4 11/30/23, 08:43