AttributeError: 'NoneType' object has no attribute 'startswith'
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3.4k
- Forks
- 663
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
When I run qark against java code I get the error below. When I try it with the apk file it gets stuck at some point and waits until I cancel the job.
System: Ubuntu 18.04
Installed with: pip install --user qark
python version 2.7
I also tried installing with pip3 and compiling the code. I got the same errors.
qark --java .
Decompiling...
Running scans...
Traceback (most recent call last):
File "/home/mk/.local/bin/qark", line 11, in <module>
sys.exit(cli())
File "/home/mk/.local/lib/python2.7/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/home/mk/.local/lib/python2.7/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/home/mk/.local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/mk/.local/lib/python2.7/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/home/mk/.local/lib/python2.7/site-packages/click/decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/mk/.local/lib/python2.7/site-packages/qark/qark.py", line 90, in cli
scanner.run()
File "/home/mk/.local/lib/python2.7/site-packages/qark/scanner/scanner.py", line 64, in run
self._run_checks(plugins)
File "/home/mk/.local/lib/python2.7/site-packages/qark/scanner/scanner.py", line 78, in _run_checks
current_file_subject.notify(filepath)
File "/home/mk/.local/lib/python2.7/site-packages/qark/scanner/scanner.py", line 125, in notify
observer.update(file_path, call_run=True)
File "/home/mk/.local/lib/python2.7/site-packages/qark/scanner/plugin.py", line 239, in update
super(CoroutinePlugin, self).update(file_path)
File "/home/mk/.local/lib/python2.7/site-packages/qark/scanner/plugin.py", line 185, in update
JavaASTPlugin.java_ast = javalang.parse.parse(self.file_contents)
File "/home/mk/.local/lib/python2.7/site-packages/javalang/parse.py", line 52, in parse
parser = Parser(tokens)
File "/home/mk/.local/lib/python2.7/site-packages/javalang/parser.py", line 95, in __init__
self.tokens = util.LookAheadListIterator(tokens)
File "/home/mk/.local/lib/python2.7/site-packages/javalang/util.py", line 92, in __init__
self.list = list(iterable)
File "/home/mk/.local/lib/python2.7/site-packages/javalang/tokenizer.py", line 508, in tokenize
if comment.startswith("/**"):
AttributeError: 'NoneType' object has no attribute 'startswith'
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with qark/scanner/plugin.py at the update path shown in the traceback, then inspect the javalang tokenizer at line 508 where comment.startswith("/**") fails. Reproduce with qark --java . and determine how the reported Java scan error, and possibly the APK hang, should complete without the AttributeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, python
- Domain
- security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100