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

MAX_DATA_SIZE is too low for full support of "Structured-appended" feature #185

Open
misaki-web opened this issue Aug 2, 2021 · 3 comments · May be fixed by #186
Open

MAX_DATA_SIZE is too low for full support of "Structured-appended" feature #185

misaki-web opened this issue Aug 2, 2021 · 3 comments · May be fixed by #186

Comments

@misaki-web
Copy link

The following command returns an error Input data is too large but I would have expected input data spread over several QR codes (output-01.png, output-02.png, etc.):

$ qrencode -t PNG -Sv 40 -r input.txt -o output.png
Input data is too large.

According to the manual: "Libqrencode can generate "Structured-appended" symbols that enables to split a large data set into mulitple QR codes."

Version tested:

$ qrencode -V
qrencode version 4.1.1
Copyright (C) 2006-2017 Kentaro Fukuchi
@lemniscati
Copy link

@misa-ki, how many symbols do you expect to be generated?
When more than 16 symbols are needed, the data is too large in fact.

According to QR Code Outline specification, at most 16 symbols are allowed in structured appending.

And, #define MAX_STRUCTURED_SYMBOLS 16 is set in qrinput.h (v4.1.1).

@misaki-web
Copy link
Author

@lemniscati I'm expecting less than 16 chained QR codes because my input file is not so large:

$ file -i input.txt 
input.txt: text/plain; charset=us-ascii
$ cat input.txt | wc -c
15000
$ cat input.txt | sed 's/./\0\n/g' | sort -uV | tr -d $'\n'
.ACDEFILMNPQSUVabcdefghijlmnopqrstuvx ,;
$ qrencode -t PNG -Sv 40 -r input.txt -o output.png
Input data is too large.

I've made some tests and it seems to work only up to 14179 characters (generating 5 QR codes from output-01.png to output-05.png), but I'm not sure why it fails starting from 14180 characters:

$ tr -dc a-z < /dev/urandom | head -c 14179 > input-14179.txt
$ qrencode -t PNG -Sv 40 -r input-14179.txt -o output.png
$ ls output*.png
output-01.png  output-02.png  output-03.png  output-04.png  output-05.png
$ tr -dc a-z < /dev/urandom | head -c 14180 > input-14180.txt
$ qrencode -t PNG -Sv 40 -r input-14180.txt -o output.png
Input data is too large.

@lemniscati
Copy link

lemniscati commented Aug 2, 2021

The error message comes from a function readFile() in qrenc.c (v4.1.1).

And this limitation is brought by the definition of MAX_DATA_SIZE:

#define MAX_DATA_SIZE (7090 * 2) /* timed by the safty factor 2 */

It seems that MAX_DATA_SIZE in qrenc.c should be larger.
And, maybe it suffices that #define MAX_DATA_SIZE (7089 * 16 + 1), for example.

@misaki-web misaki-web changed the title Is structured-appended feature working? MAX_DATA_SIZE is too low for full support of "Structured-appended" feature Aug 2, 2021
lemniscati added a commit to cygwin-lem/qrencode-cygport that referenced this issue Aug 3, 2021
Fix the issue #185 in the upstream: fukuchi/libqrencode#185
cf. the pull-request #186: fukuchi/libqrencode#186
lemniscati added a commit to cygwin-lem/qrencode-cygport that referenced this issue Aug 3, 2021
Fix the issue #185 in the upstream: fukuchi/libqrencode#185
cf. the pull-request #186: fukuchi/libqrencode#186
lemniscati added a commit to cygwin-lem/qrencode-cygport that referenced this issue Aug 3, 2021
Fix the issue #185 in the upstream: fukuchi/libqrencode#185
cf. the pull-request #186: fukuchi/libqrencode#186
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

Successfully merging a pull request may close this issue.

2 participants