Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

bugzoo does not play well with byte literals in program output #1

#1

I have a testing environment which requires byte literals to expose security flaws in the test cases, so that they can be patched later.
I see the following error when running bugzoo bug validate <mybug> in the negative test case:

Running test: n1...

================================================================================
An unexpected error occurred during execution:

  UnicodeDecodeError('utf-8', b'Processing Input 0000000000000000000000000000000000000000000000000000000000000000????1111\r\nu\x15>\xfe\x7f\r\n', 94, 95, 'invalid start byte')

See log file for details: /home/bss-lab-1/.bugzoo/logs/2019-06-24_16:15:10.bugzoo.log

from the log file specified above:

4425 ERROR:bugzoo.cli.app:2019-06-24 16:15:27,546: An unexpected error occurred
4426 Traceback (most recent call last):
4427   File "/home/bss-lab-1/Darjeeling/djling_venv/lib/python3.6/site-packages/bugzoo/cli/app.py", line 76, in main
4428     app.run()
4429   File "/home/bss-lab-1/Darjeeling/djling_venv/lib/python3.6/site-packages/cement/core/foundation.py", line 916, in run
4430     return_val = self.controller._dispatch()
4431   File "/home/bss-lab-1/Darjeeling/djling_venv/lib/python3.6/site-packages/cement/ext/ext_argparse.py", line 808, in _dispatch
4432     return func()
4433   File "/home/bss-lab-1/Darjeeling/djling_venv/lib/python3.6/site-packages/bugzoo/cli/controllers/bug.py", line 136, in validate
4434     if bz.bugs.validate(bug, verbose=self.app.pargs.verbose):
4435   File "/home/bss-lab-1/Darjeeling/djling_venv/lib/python3.6/site-packages/bugzoo/mgr/bug.py", line 188, in validate
4436     verbose=verbose)
4437   File "/home/bss-lab-1/Darjeeling/djling_venv/lib/python3.6/site-packages/bugzoo/mgr/container.py", line 400, in execute
4438     verbose=verbose)
4439   File "/home/bss-lab-1/Darjeeling/djling_venv/lib/python3.6/site-packages/bugzoo/mgr/container.py", line 580, in command
4440     line = line.decode('utf-8').rstrip('\n')
4441 UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfe in position 94: invalid start byte
  • replies 1
  • views 2K
  • likes 0
#2

It looks like amending line.decode('utf-8').rstrip('\n') from mgr/container.py to include "backslashreplace", allowed bugzoo bug validate <mybug> to pass test cases:

579         for line in out:
580             line = line.decode('utf-8',"backslashreplace").rstrip('\n')
581             if verbose:
582                 print(line, flush=True)
583             output.append(line)