cursorless-dev / cursorless

Don't let the cursor slow you down
https://www.cursorless.org/
MIT License
1.14k stars 80 forks source link

Trying to take text inside double quotes causes "memory access out of bounds" #926

Open fatalerrorx opened 2 years ago

fatalerrorx commented 2 years ago

Hello,

When I try to say the following "take inside quad urge" I get the following error from cursorless "memory access out of bounds"

The following snippet reproduces the error:

<!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>

<p>My first paragraph. 
<a href="url">link text</a>
</p>

</body>
</html>

cursorless_bug

AndreasArvidsson commented 2 years ago

Just tested it and it works fine on my machine. Can you show a screenshot of the entire error message? Are you on the latest version of cursorless and vscode?

fatalerrorx commented 2 years ago

Hello,

It seems to be the workspace that I have. If I copy and paste the code to another workspace everything seems to work correctly.

Will try and make a project that can reproduce the problem.

cursorless_bug

fatalerrorx commented 2 years ago
Exception: memory access out of bounds
2022-08-29 17:37:48 ERROR    19:                                talon/scripting/talon_script.py:589| 
   18:                                talon/scripting/talon_script.py:297| 
   17:                                talon/scripting/talon_script.py:556| 
   16:                                     talon/scripting/actions.py:85 | 
   15:                                       talon/scripting/types.py:411| 
   14:                   user/cursorless-talon/src/actions/actions.py:71 | return actions.user.cursorless_command..
   13:                                     talon/scripting/actions.py:85 | 
   12:                                       talon/scripting/types.py:411| 
   11:                   user/cursorless-talon/src/actions/actions.py:60 | return actions.user.cursorless_single_..
   10:                                     talon/scripting/actions.py:85 | 
    9:                                       talon/scripting/types.py:411| 
    8:                           user/cursorless-talon/src/command.py:35 | actions.user.cursorless_multiple_targe..
    7:                                     talon/scripting/actions.py:85 | 
    6:                                       talon/scripting/types.py:411| 
    5:                           user/cursorless-talon/src/command.py:97 | actions.user.vscode_with_plugin_and_wa..
    4:                                     talon/scripting/actions.py:85 | 
    3:                                       talon/scripting/types.py:411| 
    2: user/knausj_talon/apps/vscode/command_client/command_client.py:331| run_vscode_command(
    1: user/knausj_talon/apps/vscode/command_client/command_client.py:204| raise Exception(decoded_contents["error"])
Exception: memory access out of bounds

[The below error was raised while handling the above exception(s)]
2022-08-29 17:37:48 ERROR cb error topic="phrase" cb=<bound method SpeechSystem.engine_event of <talon.scripting.speech_system.SpeechSystem object at 0x7fe61c1683b0>>
   30:       lib/python3.9/threading.py:937* # cron thread
   29:       lib/python3.9/threading.py:980* 
   28:       lib/python3.9/threading.py:917* 
   27:                    talon/cron.py:155| 
   26:                    talon/cron.py:106| 
   25:                     talon/vad.py:21 | 
   24: talon/scripting/speech_system.py:356| 
   23:             talon/engines/w2l.py:709| 
   22:      talon/scripting/dispatch.py:105| 
   21:      talon/scripting/dispatch.py:144| 
   20:      talon/scripting/dispatch.py:133| 
   19:          talon/scripting/rctx.py:233| # 'phrase' main:_redispatch()
   18: talon/scripting/speech_system.py:63 | 
   17:      talon/scripting/dispatch.py:105| 
   16:      talon/scripting/dispatch.py:144| 
   15:      talon/scripting/dispatch.py:133| 
   14: ------------------------------------# [stack splice]
   13:          talon/scripting/rctx.py:233| # 'phrase' main:engine_event()
   12: talon/scripting/speech_system.py:410| 
   11:       talon/scripting/actions.py:85 | 
   10:         talon/scripting/types.py:411| 
    9:     talon/scripting/core/core.py:103| 
    8:       talon/scripting/actions.py:85 | 
    7:         talon/scripting/types.py:411| 
    6:     talon/scripting/core/core.py:132| 
    5:       talon/scripting/actions.py:85 | 
    4:         talon/scripting/types.py:411| 
    3:     talon/scripting/core/core.py:139| 
    2:  talon/scripting/talon_script.py:690| 
    1:  talon/scripting/talon_script.py:593| 
talon.scripting.talon_script.TalonScriptError: 
 in script at /home/boss/.talon/user/cursorless-talon/src/cursorless.talon:5:
 > user.cursorless_action_or_vscode_command(cursorless_action_or_vscode_command, cursorless_target)
Exception: memory access out of bounds
fatalerrorx commented 2 years ago

Visual studio code stack trace:


console.ts:137 [Extension Host] RuntimeError: memory access out of bounds
    at wasm://wasm/000afe02:wasm-function[217]:0x2288c
    at Parser.parse (/home/bob/.vscode-oss/extensions/pokey.parse-tree-0.21.0/node_modules/web-tree-sitter/tree-sitter.js:1:35269)
    at openIfLanguageLoaded (/home/bob/.vscode-oss/extensions/pokey.parse-tree-0.21.0/out/extension.js:109:39)
    at getTreeForUri (/home/bob/.vscode-oss/extensions/pokey.parse-tree-0.21.0/out/extension.js:186:29)
    at Object.getNodeAtLocation (/home/bob/.vscode-oss/extensions/pokey.parse-tree-0.21.0/out/extension.js:206:24)
    at qi (/home/bob/.vscode-oss/extensions/pokey.cursorless-0.26.418/dist/extension.js:40:139)
    at ik (/home/bob/.vscode-oss/extensions/pokey.cursorless-0.26.418/dist/extension.js:40:14697)
    at eg.run (/home/bob/.vscode-oss/extensions/pokey.cursorless-0.26.418/dist/extension.js:40:14642)
    at /home/bob/.vscode-oss/extensions/pokey.cursorless-0.26.418/dist/extension.js:40:17451
    at Array.flatMap (<anonymous>)
    at /home/bob/.vscode-oss/extensions/pokey.cursorless-0.26.418/dist/extension.js:40:17438
    at Array.forEach (<anonymous>)
    at cd (/home/bob/.vscode-oss/extensions/pokey.cursorless-0.26.418/dist/extension.js:40:17422)
    at tg (/home/bob/.vscode-oss/extensions/pokey.cursorless-0.26.418/dist/extension.js:40:17342)
    at WE (/home/bob/.vscode-oss/extensions/pokey.cursorless-0.26.418/dist/extension.js:40:16146)
    at /home/bob/.vscode-oss/extensions/pokey.cursorless-0.26.418/dist/extension.js:40:16005
    at Array.map (<anonymous>)
    at $E (/home/bob/.vscode-oss/extensions/pokey.cursorless-0.26.418/dist/extension.js:40:15995)
    at $h.runCommand (/home/bob/.vscode-oss/extensions/pokey.cursorless-0.26.418/dist/extension.js:96:11652)
    at async a._executeContributedCommand (/usr/lib/code/out/vs/workbench/api/node/extensionHostProcess.js:85:63914)
I   @   console.ts:137
```
pokey commented 2 years ago

huh. Maybe re-install parse tree extension?

fatalerrorx commented 2 years ago

Unfortunately same problem occurs. In fact any time I say "take inside air" or "take inside bat" etc I get the above error. It only seems to be this one workspace that I'm working on all others are fine.

pokey commented 2 years ago

And it's just in that one workspace?

fatalerrorx commented 2 years ago

Yep

fatalerrorx commented 2 years ago

The workspace that I'm working on has a lot golang templates. Such as the following:


{{/*
Copyright (C) 2019  VHS <vhsdev@tutanota.com>

This file is part of After Dark.

After Dark is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

After Dark is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.
*/ -}}

+++
title = "{{ replace .TranslationBaseName "-" " " | title }}"
date = {{ .Date }}
description = "This text is displayed in search result listings."
draft = true
[[copyright]]
  owner = "{{ .Site.Params.author | default .Site.Title }}"
  date = "{{ now.Format "2006" }}"
  license = "cc-by-nd-4.0"
+++
fatalerrorx commented 2 years ago

I think I have a reproducible sample. Try opening the following as a workspace and use "take inside quad" on various strings that are inside double quotes and the problem should rear its head. At least I was able to reproduce it consistently.

test.zip

pokey commented 2 years ago

Do any syntactic scope types work? Eg "take funk"

It's super odd that one file would affect another btw

fatalerrorx commented 2 years ago

Unfortunately I am unable to test any other syntactic scope types as the workspace only has various HTML and Hugo templates. I take it that the sample workspace I uploaded previously works fine for you?

AndreasArvidsson commented 2 years ago

You could try take element

fatalerrorx commented 2 years ago

I can confirm that other syntactic scope types give the same error.