Skip to content
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

consider specifying encoding in calls to open #16

Open
michaelmera opened this issue Nov 19, 2021 · 2 comments
Open

consider specifying encoding in calls to open #16

michaelmera opened this issue Nov 19, 2021 · 2 comments

Comments

@michaelmera
Copy link
Contributor

michaelmera commented Nov 19, 2021

When no encoding is specified, the actual encoding used is platform dependent. This means that if you prepare example files for a reviewer, he might not be able to run the code on his machine.

Note however that reviewers might have then a problem if they prepare files with a different encoding than the one you specified.

PyGlade/src/glade.py

Lines 787 to 818 in dcf503d

with open('inputs') as f:
inputs = [line.strip() for line in f]
if len(inputs) == 0:
print("inputs file is empty! Please provide inputs.")
sys.exit()
for input_str in inputs:
regexes.append(phase_1([i for i in input_str]))
print("One regex done")
print("\n+++++ Phase 1 Done +++++\n")
# Combine regexes into one regex as explained in Section 6.1
regex = regexes[0]
regexes.pop(0)
for reg in regexes:
regex = Alt(regex, reg, False)
print("Final regex: " + str(regex))
cfg, start = phase_2(regex)
with open('grammar_.json', 'w+') as f:
json.dump({'<start>': [[start]], **cfg}, indent=4, fp=f)
print('\n+++++ Merging Phase Begins +++++\n')
merged = phase_3(cfg, start)
# Save the final grammar in the fuzzing book format
with open('grammar.json', 'w+') as f:
json.dump({'<start>': [[start]], **merged}, indent=4, fp=f)

with open(fn) as f:

@bendrissou
Copy link
Collaborator

What encoding should we specify? @vrthra

@vrthra
Copy link
Owner

vrthra commented Nov 22, 2021

We can stick to ASCII I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants