Skip to content

AssertionError during decode if payload takes around more than 2 and less than 64 grids. Successful decodes could have null bytes at the end. #4

@Cerlancism

Description

@Cerlancism

Hello once again.

I was experimenting around with this library, I found that the decoding part has quite a bit of issues.

Take the following 3 test payloads.

test1.txt

test

test2.txt

test test

test3.txt

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

test test

All these ran using the example image with 0.45 alpha.

test1.txt and test3.txt successfully encoded and decoded. However the decoded test1.txt and test3.txthas 3 and 5 null bytes respectively at the end of file.
test2.txt passed encoding but suddenly fails at decoding as it throws AssertionError. I tested around the length of message and found it always would fail if it takes up around more than 2 grids but less than 64.

Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/runner/BPCS-Test/bpcs_mobeets/bpcs/bpcs.py", line 55, in <module>
    decode(opts.infile, opts.outfile, opts.alpha)
  File "/home/runner/BPCS-Test/bpcs_mobeets/bpcs/bpcs_steg_decode.py", line 34, in decode
    write_conjugated_message_grids(outfile, grids, alpha)
  File "/home/runner/BPCS-Test/bpcs_mobeets/bpcs/array_message.py", line 190, in write_conjugated_message_grids
    messages, conj_map_grids, nbits_per_map = separate_conj_map_from_message(grids, alpha)
  File "/home/runner/BPCS-Test/bpcs_mobeets/bpcs/array_message.py", line 174, in separate_conj_map_from_message
    x = get_n_message_grids(nbits_per_map, ngrids)
  File "/home/runner/BPCS-Test/bpcs_mobeets/bpcs/array_message.py", line 154, in get_n_message_grids
    assert x > 0
AssertionError

I have setup a REPL.it workspace to show my test results:
https://repl.it/@Cerlancism/BPCS-Test#main.sh

I have reduced the size of image to 150x150 to speed up in REPL.it. Similar results shows for the provided example image.

Update

One of my friend catkane-doodles has forked this repo and he seemed to have fixed this. However, he did a complete revamp. Not sure if we could PR in.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions