Commit graph

68 commits

Author SHA1 Message Date
Alexandre Perrin
1f9edb0b84 Fix a potential use-after-free on quirc_resize failure.
Before this patch, in the event of `q->image` reallocation success but
`q->pixels` failure, `q->image` would point to a freed memory.

After this patch, once quirc_resize() returns, `q->image` consistently
point to a memory address that can be freed.

There is still an inconsistency left in the example codepath: `q->{h,w}`
would hold the "old" values, while `q->image` allocated size would be
based in the requested width/height; hence the comment update about the
state of the QR-code recognizer (it should only be passed to
quirc_destroy()).
2017-06-07 19:37:14 +02:00
Daniel Beer
fce4b94bb2 mjpeg: remember to set dinfo.err. 2017-05-31 17:52:55 +12:00
Daniel Beer
ffc2f9b68a dbgutil: fix double-free on error in jpeg_finish_decompress. 2017-05-31 17:52:26 +12:00
Daniel Beer
5174ba77f8 Merge pull request #34 from kAworu/decode_kanji.fix
Fix Kanji decoding.
2017-05-31 08:23:33 +12:00
Alexandre Perrin
2528ea3955 Comment fix
Bad copy-pasta from
http://www.thonky.com/qr-code-tutorial/kanji-mode-encoding
2017-05-30 19:23:42 +02:00
Alexandre Perrin
e16c02e226 Fix Kanji decoding.
Before this patch, Kanji decoding was broken.
2017-05-30 18:52:31 +02:00
Daniel Beer
3c31aa0987 Fix potential leak on allocation failure in quirc_resize(). 2017-05-18 19:29:02 +12:00
Daniel Beer
c4abca0eec Merge pull request #30 from nuxeh/edcragg/fix-last-color-warning
identify: fix warning
2017-05-01 11:13:35 +12:00
Edward Cragg
c50a89276f identify: fix warning
Fix the following warning when compiling with GCC 6:

lib/identify.c: In function ‘quirc_end’:
lib/identify.c:430:6: warning: ‘last_color’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  int last_color;
      ^~~~~~~~~~
2017-04-30 10:42:14 +01:00
Daniel Beer
26a182814d Merge pull request #29 from mjbshaw/patch-1
Fix documentation regarding cell_bitmap indexing
2017-04-26 10:28:48 +12:00
Michael Bradshaw
e0a5f5fd3f Fix documentation regarding cell_bitmap indexing 2017-04-25 04:27:17 -07:00
Daniel Beer
84eccbf077 Fix out-of-bounds read in fitness_all(). 2017-03-30 18:05:49 +13:00
Daniel Beer
a5513dc49d Merge pull request #24 from ilgk/gitignore
gitignore: Ignore macOS .DS_Store files.
2017-02-17 10:01:05 +13:00
Daniel Beer
9a299fad73 Merge pull request #25 from ilgk/cpp
quirc.h : Fix C++ function name mangling with extern C.
2017-02-17 09:59:33 +13:00
Philippe Groarke
64a4e58543 quirc.h : Fix C++ function name mangling with extern C. 2017-02-16 14:32:18 -05:00
Philippe Groarke
676d401382 gitignore: Ignore macOS .DS_Store files. 2017-02-16 14:23:24 -05:00
Daniel Beer
59182ef1cd Deinterleave blocks correct.
Use explicit small-block count. Derived value using greedy calculation
wasn't correct in many cases.
2016-12-28 15:37:18 +13:00
Daniel Beer
fccbbce758 version_db.c: fix basic errors. 2016-12-28 14:09:06 +13:00
Daniel Beer
88774dc6cf decode.c: fix count bit-width on alphanumeric payloads. 2016-11-17 11:37:55 +13:00
Daniel Beer
aeb9b88d1a Merge pull request #21 from kAworu/threshold-fix
Avoid division by zero.
2016-10-05 07:48:40 +13:00
Alexandre Perrin
6f0ed74aa2 Comment typo. 2016-10-04 11:13:49 +02:00
Alexandre Perrin
93adbb0b11 Avoid division by zero.
Before this patch, small images (i.e. 7x7 pixels or less) could trigger
SIGFPE because of a (integer) division by zero.
2016-10-04 11:10:55 +02:00
Daniel Beer
87e79e769b Fix Reed-Solomon decoder.
Calculate the correct number of syndromes, and fix calculation of the
error locator polynomial. Many QR codes with logos in the middle should
now work.
2016-09-23 14:34:07 +12:00
Daniel Beer
ab341691c9 Add support for ECI decoding.
ECI values are decoded and stored in the eci field of struct quirc_data.
Constants of the form QUIRC_ECI_* are defined in quirc.h.
2016-09-23 09:50:59 +12:00
Daniel Beer
a8291391ec dbgutil: print unknown data type indicators safely. 2016-09-23 09:40:56 +12:00
Daniel Beer
08fe9f7e0f Fall back to set_strip() on older libpng versions.
Latest Debian release right now packages only 1.2.50.
2016-09-06 08:08:58 +12:00
Daniel Beer
5b26248009 Merge pull request #18 from czarkoff/png
Fix png image handling
2016-08-16 09:36:49 +12:00
Daniel Beer
3ddd39c952 Merge pull request #17 from czarkoff/clock
Consistant typing for test timing variables
2016-08-16 09:35:20 +12:00
Dmitrij D. Czarkoff
8decf20d4f Strip alpha channel from PNG images with tRNS chunk
When PNG transformations are set up, tRNS chunk is converted to alpha channel
early in the process.  Later the decision whether to strip alpha channel or not
is made upon checking (color_type & PNG_COLOR_MASK_ALPHA).  Thus alpha channel
created by tRNS chunk conversion does not get stripped.
2016-08-15 15:39:18 +02:00
Dmitrij D. Czarkoff
2e3e80c1ee Use more accurate bit depth reduction for PNG images 2016-08-15 14:32:17 +02:00
Dmitrij D. Czarkoff
3266bbaf39 Consistant typing for test timing variables 2016-08-15 10:24:01 +02:00
Daniel Beer
b0fc6bfd5f Merge pull request #16 from czarkoff/clock
Use clock_gettime() instead of clock()
2016-08-15 12:26:56 +12:00
Dmitrij D. Czarkoff
1de1a466b8 Store time in milliseconds 2016-08-15 00:28:24 +02:00
Dmitrij D. Czarkoff
c13db788bb Use clock_gettime() instead of clock()
clock() provides approximation of processor time used, measured in "clocks".
Amount of clock per second varies between 100 (Minix, NetBSD, OpenBSD), 128
(DragonFly BSD, FreeBSD, older versions of MacOS X), 1000 (Windows) and 1000000
(Linux, newer versions of MacOS X, Solaris).  The range of these numbers make
conversion to milliseconds (the unit of display in `qrtest`) problematic.
clock_gettime() with its nanosecond time base appears to be a better and more
portable alternative to clock().
2016-08-13 23:14:55 +02:00
Dmitrij D. Czarkoff
e9b279786a Ignore libquirc.so with any suffix 2016-08-11 12:26:08 +02:00
Dmitrij D. Czarkoff
47f99adf28 Move -fPIC to default CFLAGS 2016-08-11 12:25:08 +02:00
Dmitrij D. Czarkoff
f7549f0948 Avoid '$^' variable
GNU make extension, which is not supported by other make programs.
2016-08-11 11:35:55 +02:00
Dmitrij D. Czarkoff
3731dc0b46 Use proper inference rules 2016-08-11 11:34:13 +02:00
Dmitrij D. Czarkoff
38b491c9ba Allow specifying linker flags 2016-08-11 00:30:47 +02:00
Dmitrij D. Czarkoff
1bd6d0f5f0 Allow overriding default CFLAGS 2016-08-11 00:29:21 +02:00
Dmitrij D. Czarkoff
4206849da9 Fix shared library instructions 2016-08-11 00:32:09 +02:00
Dmitrij D. Czarkoff
35b50246f4 Avoid '$(shell ...)' macro
$(shell ...) macro is a GNU make extension.  GNU make also supports `!=`
operator, which is more portable.
2016-08-11 00:21:17 +02:00
Dmitrij D. Czarkoff
22cd4d061c Don't compile objects twice
PIC objects can be used for static library as well, so there is no reason to
build two sets of objects.
2016-08-11 00:18:58 +02:00
Daniel Beer
b19987eb6a Merge pull request #14 from czarkoff/png14
Replaced remaining instance of png_infopp_NULL
2016-08-11 13:48:54 +12:00
Daniel Beer
271173c1f5 Merge pull request #13 from czarkoff/openbsd
Fix V4L2 includes on OpenBSD
2016-08-11 13:48:40 +12:00
Dmitrij D. Czarkoff
894e8c8b2d Replaced remaining instance of png_infopp_NULL 2016-08-11 01:21:45 +02:00
Dmitrij D. Czarkoff
4ca654da50 Fix V4L2 includes on OpenBSD 2016-08-11 01:06:51 +02:00
Daniel Beer
e6e8c381bb Merge pull request #12 from czarkoff/png14
Fix compatibility with newer libpng
2016-08-11 10:37:47 +12:00
Dmitrij D. Czarkoff
176ba28362 Fix compatibility with newer libpng 2016-08-11 00:02:38 +02:00
Daniel Beer
d968f0ae33 Merge pull request #11 from kAworu/display-human-readable-data-type
dump_data: display a human readable Data type.
2016-07-20 08:24:06 +12:00