Comments (4)
At least one crash is actually a sievelib
bug. The following script crashes the sievelib parser:
if address :domain "" ""){}
Traceback:
Traceback (most recent call last):
File "~\.virtualenvs\strainer-40YVjBHe\lib\site-packages\sievelib\parser.py", line 400, in parse
if not self.__command(ttype, tvalue):
File "~\.virtualenvs\strainer-40YVjBHe\lib\site-packages\sievelib\parser.py", line 322, in __command
self.__up()
File "~\.virtualenvs\strainer-40YVjBHe\lib\site-packages\sievelib\parser.py", line 157, in __up
if self.__curcommand.must_follow is not None:
AttributeError: 'NoneType' object has no attribute 'must_follow'
from strainer.
In master, the problem still exists, but traceback is a bit different:
Traceback (most recent call last):
File "~/sievelib/sievelib/parser.py", line 435, in parse
if not self.__command(ttype, tvalue):
File "~/sievelib/sievelib/parser.py", line 375, in __command
if self.__cstate(ttype, tvalue):
File "~/sievelib/sievelib/parser.py", line 328, in __arguments
if self.__argument(ttype, tvalue):
File "~/sievelib/sievelib/parser.py", line 285, in __argument
self.__curcommand.non_deterministic_args
AttributeError: 'NoneType' object has no attribute 'non_deterministic_args'
Interestingly, if address :domain "" ""){
crashes in master (with the same error), but does not crash in 1.1.1. if address :domain "" ""))
crashes with the same error as in 1.1.1. Both versions do not crash with either if address :domain "" "")
, if address :domain "")
, or if address :domain "" "" "")
.
from strainer.
Even simpler: }
crashes as well. I think the problem is that the parser doesn't properly keep track of parenthesis / bracket depth. It just encounters a close bracket and assumes that it was properly opened. To solve this, we could introduce a stack of opened brackets, and when a close bracket mismatches, it's an instant parse error.
However, this would also mean that during partial lexing, I will have to backtrack to when the bracket was opened...
One solution would be to always use the entire file in partial lexing, but to only change styling between start and end (and wherever the first token starts / last token ends). I will create an issue for this.
My bad, partial lexing doesn't use the parser, only the lexer. Doesn't apply here.
from strainer.
Reopened to implement a workaround since sievelib bug is still open.
from strainer.
Related Issues (18)
- Decrease time before first UI element is shown
- Asynchronous ManageSieve requests are busted
- Accounts with identical names overwrite each other
- Clicking on "elsif" or "else"
- Partial lexing: always use entire text HOT 2
- Search function in browser and editor HOT 1
- Save scripts HOT 1
- New lexer / parser based on Lark
- Activate / delete scripts
- Add list of all parse errors
- Add more grammar features HOT 1
- GUI to return to homepage HOT 1
- Enable partial re-lexing HOT 3
- Reimplement edit menu
- Better sieve error analysis
- Convert to QSettings, save main window state
- Status bar content resizes window
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from strainer.