New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Credicle bug of this dictionary. #4834

Closed
nvaccessAuto opened this Issue Jan 20, 2015 · 8 comments

Comments

Projects
None yet
3 participants
@nvaccessAuto

nvaccessAuto commented Jan 20, 2015

Reported by vgjh2005 on 2015-01-20 08:14
Hi:
This dic file include errors, and put it in speechdic folder, Press CTRL+ALT+N to restart NVDA, NVDA will not start again at all. There are also no error information. Thanks!

@nvaccessAuto

This comment has been minimized.

Show comment
Hide comment
@nvaccessAuto

nvaccessAuto Jan 20, 2015

Attachment default.dic added by vgjh2005 on 2015-01-20 08:15
Description:

nvaccessAuto commented Jan 20, 2015

Attachment default.dic added by vgjh2005 on 2015-01-20 08:15
Description:

@nvaccessAuto

This comment has been minimized.

Show comment
Hide comment
@nvaccessAuto

nvaccessAuto Jan 20, 2015

Comment 1 by chrislm on 2015-01-20 09:34
Please check your default.dic in line 41.
Error: unbalanced parenthesis

nvaccessAuto commented Jan 20, 2015

Comment 1 by chrislm on 2015-01-20 09:34
Please check your default.dic in line 41.
Error: unbalanced parenthesis

@nvaccessAuto

This comment has been minimized.

Show comment
Hide comment
@nvaccessAuto

nvaccessAuto Jan 20, 2015

Comment 2 by vgjh2005 on 2015-01-20 10:18
Hi:
Yes. you're right. This isn't my point. My point is that NVDA cannot launch correctly. I can hear a error sound, and NVDA isn't launched. I have made more times for this. Thanks!

nvaccessAuto commented Jan 20, 2015

Comment 2 by vgjh2005 on 2015-01-20 10:18
Hi:
Yes. you're right. This isn't my point. My point is that NVDA cannot launch correctly. I can hear a error sound, and NVDA isn't launched. I have made more times for this. Thanks!

@nvaccessAuto

This comment has been minimized.

Show comment
Hide comment
@nvaccessAuto

nvaccessAuto Jan 20, 2015

Comment 3 by jteh on 2015-01-20 10:40
Changes:
Milestone changed from None to next

nvaccessAuto commented Jan 20, 2015

Comment 3 by jteh on 2015-01-20 10:40
Changes:
Milestone changed from None to next

@nvaccessAuto nvaccessAuto added this to the next milestone Nov 10, 2015

@jcsteh jcsteh removed this from the next milestone Jun 24, 2016

@feerrenrut

This comment has been minimized.

Show comment
Hide comment
@feerrenrut

feerrenrut Jul 1, 2016

Contributor

default.dic.txt

The attachment referenced, just remove the .txt extension.

Contributor

feerrenrut commented Jul 1, 2016

default.dic.txt

The attachment referenced, just remove the .txt extension.

@feerrenrut

This comment has been minimized.

Show comment
Hide comment
@feerrenrut

feerrenrut Jul 1, 2016

Contributor

Trace from log:

Traceback (most recent call last):
  File "nvda.pyw", line 190, in <module>
    core.main()
  File "core.py", line 198, in main
    speechDictHandler.initialize()
  File "speechDictHandler.py", line 108, in initialize
    dictionaries["default"].load(os.path.join(speechDictsPath, "default.dic"))
  File "speechDictHandler.py", line 70, in load
    self.append(SpeechDictEntry(temp[0].replace(r'\#','#'),temp[1].replace(r'\#','#'),comment,bool(int(temp[2])),int(temp[3])))
  File "speechDictHandler.py", line 37, in __init__
    self.compiled = re.compile(tempPattern,flags)
  File "C:\Python27\lib\re.py", line 194, in compile
    return _compile(pattern, flags)
  File "C:\Python27\lib\re.py", line 251, in _compile
    raise error, v # invalid expression
error: unbalanced parenthesis
Contributor

feerrenrut commented Jul 1, 2016

Trace from log:

Traceback (most recent call last):
  File "nvda.pyw", line 190, in <module>
    core.main()
  File "core.py", line 198, in main
    speechDictHandler.initialize()
  File "speechDictHandler.py", line 108, in initialize
    dictionaries["default"].load(os.path.join(speechDictsPath, "default.dic"))
  File "speechDictHandler.py", line 70, in load
    self.append(SpeechDictEntry(temp[0].replace(r'\#','#'),temp[1].replace(r'\#','#'),comment,bool(int(temp[2])),int(temp[3])))
  File "speechDictHandler.py", line 37, in __init__
    self.compiled = re.compile(tempPattern,flags)
  File "C:\Python27\lib\re.py", line 194, in compile
    return _compile(pattern, flags)
  File "C:\Python27\lib\re.py", line 251, in _compile
    raise error, v # invalid expression
error: unbalanced parenthesis

@feerrenrut feerrenrut self-assigned this Jul 1, 2016

@feerrenrut

This comment has been minimized.

Show comment
Hide comment
@feerrenrut

feerrenrut Jul 1, 2016

Contributor

This can also be reproduced by adding a new entry through the GUI

  • Open default dictionary settings.
  • Click add
  • fill in the fields, use an invalid regular expression for the pattern (eg unbalanced parenthesis)
  • ensure that the reg ex option is selected
  • click ok.
Contributor

feerrenrut commented Jul 1, 2016

This can also be reproduced by adding a new entry through the GUI

  • Open default dictionary settings.
  • Click add
  • fill in the fields, use an invalid regular expression for the pattern (eg unbalanced parenthesis)
  • ensure that the reg ex option is selected
  • click ok.
@jcsteh

This comment has been minimized.

Show comment
Hide comment
@jcsteh

jcsteh Jul 1, 2016

Contributor
Contributor

jcsteh commented Jul 1, 2016

@nvaccessAuto nvaccessAuto added the p1 label Jul 5, 2016

@feerrenrut feerrenrut closed this in #6136 Jul 20, 2016

feerrenrut added a commit that referenced this issue Jul 20, 2016

Invalid regex expressions in dictionaries no longer causes crash. (#6136
)

Fixes #4834
PR: #6136 

This change introduces a safety check when loading speech dictionaries, to ensure that nvda does not crash if the dictionaries contain invalid regex. This change also catches the same situation in the UI and informs the user that the regex is invalid.

- When adding a dictionary entry with invalid regex, the error message now states that this is a regex error and qoutes the error. It is unfortunate, but the regex error is difficult to translate.
- If a user does manage to introduce an error into a dictionary file, then the nvda will import all valid lines in the file, reporting warnings to the log for lines in the dictionary that are invalid.

feerrenrut added a commit that referenced this issue Jul 20, 2016

Update changes file (#4834)
When editing dictionary entries, feedback is now given for invalid regular expressions. NVDA no longer crashes if a dictionary file contains an invalid regular expression.

@jcsteh jcsteh added this to the 2016.3 milestone Aug 5, 2016

@feerrenrut feerrenrut removed their assignment Aug 8, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment