106 Commits

Author SHA1 Message Date
duanhan eb2f6b9b7c Merge branch 'master' of gitee.com:openharmony/third_party_libexif into 0521_libexif_update_6.25_test1
Signed-off-by: duanhan <duanhan1@huawei.com>
2025-05-22 12:51:58 +00:00
zhanglitao 871724f4ab update libexif
Signed-off-by: zhanglitao <zhanglitao11@huawei.com>
2025-05-21 15:23:17 +08:00
zhang-xiaobo1997 60667a9273 modify for vesion to 6.22
Signed-off-by: zhang-xiaobo1997 <tony.zhangxiaobo@huawei.com>
2025-05-21 15:22:02 +08:00
duanhan 4a9402248a 0521 libexif update 0.6.25
Signed-off-by: duanhan <duanhan1@huawei.com>
2025-05-21 14:47:16 +08:00
zhanglitao c7b9929323 update libexif
Signed-off-by: zhanglitao <zhanglitao11@huawei.com>
2023-05-19 12:07:34 +08:00
zhang-xiaobo1997 abda991889 modify for vesion to 6.22
Signed-off-by: zhang-xiaobo1997 <tony.zhangxiaobo@huawei.com>
2022-04-27 16:40:59 +08:00
Marcus Meissner 01a6dc44b6 added testcase to avoid regression like https://github.com/libexif/libexif/issues/79 2021-11-25 11:18:22 +01:00
Marcus Meissner 5c4b9b074e added a AFL persistent fuzzer (not hooked up to make) 2021-10-02 14:47:44 +02:00
Hans Ulrich Niedermann 1b477fdb85 Fix and avoid more warnings (#76)
* Fix sequence to "static const"

Using "static const" instead of "const static" makes this
declaration use the same sequence as all other "static"
declarations in libexif, and also avoids the occasional
gcc warning about that sequence:

warning: ‘static’ is not at beginning of declaration [-Wold-style-declaration]

* Fix signed/unsigned comparison: use size_t instead of int

sizeof() returns a size_t, and an array index is a size_t as well,
so we can use a size_t as the for loop variable in the first place.

The gcc warning this fixes is

warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]

* Add explicit /* fall through */ comments to avoid warnings

gcc recognizes a /* fall through */ comment (without any
additional words) as a hint that falling through is intended.

Otherwise, gcc generates

    warning: this statement may fall through [-Wimplicit-fallthrough=]`

* Pseudo-use unused parameter to avoid warning about unused param

The gcc warning this fixes is

warning: unused parameter ‘ed’ [-Wunused-parameter]

* Cast to (void *) for %p in format to avoid warning

The gcc warning this fixes is

warning: format ‘%p’ expects argument of type ‘void *’, but argument 2 has type ‘ExifContent *’ {aka ‘struct _ExifContent *’} [-Wformat=]

* consistently use *.h #ifndef and #endif macros

Consistently name and use the macros wrapping include files:

    /* file foo-bar.h */
    #ifndef __FOO_BAR_H__
    #define __FOO_BAR_H__

    ...

    #endif /* __FOO_BAR_H__ */

This fixes wrong comments after the #endif, and macro names
which were diverging too much from the include file name.

* configure: pseudo use variables to make checks succeed even with -Werror

Pseudo-using the result variables makes the configure compilations
work even if CFLAGS happens to contain -Werror.

Otherwise, the unused variable will trigger a warning which will be
treated like an error, which is the wrong result when trying to
find out whether compiling/linking works.
2021-09-21 09:54:56 +02:00
Marcus Meissner e79b96f8f0 added some canon tag names and subtag names 2021-09-19 14:17:38 +02:00
Marcus Meissner 2d3f0df748 adjust to latest tagname additions 2021-09-06 08:16:45 +02:00
Marcus Meissner eccb9e30a6 ignore more 2021-09-03 10:52:32 +02:00
Marcus Meissner 61f2bbdd4d update to follow the recent tag name additions 2021-09-03 10:46:53 +02:00
Heiko Lewin fc6e4abc55 add table for the gps IFD to inititalize ExifEntries properly (#70) 2021-08-03 12:48:40 +02:00
Hans Ulrich Niedermann 3b55bd4810 Fix newlines in tests when cross-compiling with mingw
When compiling libexif on a Linux build system for a Windows
host using mingw32 or mingw64, the built test programs (run
by Wine) will usually print lines to stdout using Windows
CRLF line endings.

However, several parts of the test fail with the other line
endings, e.g. known good output in a text file will have
different line endings to what the test program produces,
and the comparison will fail based on the line endings
when what really matters is the actual lines.

Anyway, this just removes all CR characters in the few
places which caused "make check" to fail for a mingw
cross compile build using by piping through

    | tr -d '\015'

Using tr -d with an octally escaped CR should not be
a portabilty problem: other parts of configure already
use tr -d with an octally escaped character.

I hope this does not cause problems on msys or other
systems where the build system uses CRLF as well. If it
does, we will need to add more complex logic to recognize
the proper line endings to use where.
2021-05-28 05:31:55 +02:00
Hans Ulrich Niedermann 3a715c1046 Use EXEEXT in test scripts
Without using EXEEXT, the tests cannot work when building
for Windows, regardless of whether this a native build or
a mingw cross compilation build.
2021-05-28 05:07:52 +02:00
Hans Ulrich Niedermann d48413d125 skipping a test works via exit 77
Just use "exit 77" to skip the check-failmalloc.sh test.

This makes it clear when running "make check" that this
test is being skipped, and does not just hide it for
just those who happen to be in the know.
2021-05-28 05:07:52 +02:00
Hans Ulrich Niedermann d5ae83e2e5 check for diff and diff -u before using it
Before actually running diff, check that diff is actually
available. And when it is possible, even use "diff -u".

And if diff is not available at all, fall back to cmp.
cmp does not produce nice verbose output, but it has
the same exit values as diff.

Oh, and we try to avoid "if ! condition" in the shell script,
as there allegedly are some corner cases where that is
problematic.
2021-05-28 05:07:52 +02:00
Hans Ulrich Niedermann 9583c1377b Use AM_TESTS_ENVIRONMENT instead of test script substitutions
Just set the required environment variable values in
AM_TESTS_ENVIRONMENT which is less complex than generating
new shell scripts from templates.
2021-05-28 05:07:52 +02:00
Marcus Meissner e492e60262 Revert "Make exif_entry_initialize() set up entries in the GPS ifd (#54)"
This reverts commit f21cf1d15e.

was not finished, see pullrequest
2021-04-21 10:07:43 +02:00
Heiko Lewin f21cf1d15e Make exif_entry_initialize() set up entries in the GPS ifd (#54)
* add table for the gps IFD to inititalize ExifEntries properly

* fix headers

* fix sizeof()

* add test

* more tests

* fix return on unknown gps-entries

Co-authored-by: Heiko Lewin <heiko.lewin@worldiety.de>
2021-04-21 08:31:30 +02:00
Marcus Meissner 6d13ffb8be exhaust more mnote possibilites 2021-01-31 08:08:20 +01:00
Marcus Meissner 8e9d5a1602 Add another fuzzing mode.
Also add logging code, default compiled out for debugging weird cases.
2021-01-30 14:10:18 +01:00
Dan Fandrich bfe508303a Fix an unused variable warning. 2020-05-16 23:15:37 +02:00
Marcus Meissner a903087b27 reduce code in fuzzer 2020-05-16 17:34:01 +02:00
Crane e2ab744c78 bugfix: change 0xa000 tag name (#38)
According to DC-08-2012
FlashPixVersion shoule be  FlashpixVersion
2020-02-24 07:50:06 +01:00
Dan Fandrich 2942f20a21 Fixed a couple of compiler warnings. 2019-08-01 00:58:47 +02:00
Dan Fandrich 3145ed9ade Add a few more NULL pointer checks.
Extended test-null.c to verify them.
Fixes #19 (reported by jonnygrant@).
2019-07-29 10:44:36 +02:00
Dan Fandrich f0c1f4e77f Added test-null to check that the API handles NULL arguments. 2019-04-27 22:43:38 +02:00
Dan Fandrich a37d5d3b61 Added test-extract.c and a new regression test extract-parse.sh.
This extracts the EXIF tags from an image then compares the parsed value
of the extracted tags with those of the original file. This ensures that
the tags are written properly, without change in tag data. The MakerNote
tag sometimes has a harmless, slight difference in size because of
padding being removed.

However, in developing this test, I found that the Olympus variant 4
MakerNote has a huge size difference. This might be harmless (there
might just be a lot of padding removed) but it's also possible that
these MakerNotes aren't being properly parsed.  This discrepancy should
be investigated.

The exif_data_save_data() function is also returning some JPEG markers
at the end of the buffer which I wasn't expecting.  This also should be
investigated.

The test is enabled anyway in the meantime to reduce the chance of
regressions in the remaining tags.
2019-02-22 16:51:48 +01:00
Dan Fandrich c49953bf7e Fixed a compiler warning in test-fuzzer 2019-02-22 16:51:48 +01:00
Marcus Meissner b958eb830c handle non-0 terminated value returns as failure 2019-02-02 19:05:25 +01:00
Marcus Meissner 18fd0ff740 abort early... we can get a very high number and this does not help 2019-02-02 19:05:25 +01:00
Dan Fandrich b064346eb3 Add check-failmalloc.sh to test OOM conditions.
This requires Failmalloc, a library that can be used along with glibc to
cause malloc calls to fail in a defined way. Configure will search for
libfailmalloc.so.0 in the usual places by default, or in a
user-specified location. The tests are skipped if it's not available.
Enable Failmalloc on the Travis coverage build.
2018-11-10 16:04:53 +01:00
Dan Fandrich 1a29e47897 Be a bit more robust in the face of out-of-memory errors.
Do a better job in leaving things in a more consistent state after an
allocation failure. Also, make the tests report and handle OOM
conditions cleanly.
2018-11-06 01:03:49 +01:00
Dan Fandrich 5d9fd2810a Added the test/testdata/* files to the dist tar ball.
This was missed in commit 5c93e6b4.
2018-11-01 18:32:04 +01:00
Dan Fandrich 8adb170013 Add swap-byte-order.sh to test libexif's byte order conversion function.
This is accomplished by adding a feature to test-parse.c to switch the
byte order before dumping the EXIF output. Additionally, the MakerNote
values are now logged in the dump as well, in the same way as the
regular tags, to better catch regressions.

This new test uncovered a bug in the decoding of the
MNOTE_NIKON_TAG_FIRMWARE tag whose data should not be treated as being
endian-specific.
2018-11-01 15:09:09 +01:00
Dan Fandrich 6ea0f9b87b Added a thumbnail to test-mem.c to ensure it's properly freed. 2018-11-01 11:23:06 +01:00
Dan Fandrich 6d1156c4fa Use exif_mnote_data_get_name in test-parse.c
This is analagous to exif_tag_get_name that is used for the regular
tags.
2018-10-31 15:11:51 +01:00
Dan Fandrich 81eb1a6386 Display unknown Canon MakerNote tag data in exif_mnote_data_get_value
Displaying an integer value is better than not displaying anything at
all, and makes Canon match the other supported MakerNote types.
2018-08-17 07:34:38 +02:00
Dan Fandrich fe15630dd5 Support signed types in some generic MakerNote formatters.
The unsigned types are now also formatted correctly as unsigned in a
number of them.
2018-08-17 07:34:28 +02:00
Dan Fandrich 5c93e6b4f0 Add a new parsing regression test.
This is intended as a fast check that all tags, including MakerNotes, can be
parsed.  It is not intended to replace the much more complete tests in
libexif-testsuite, but rather add some basic parsing test coverage without
having to download and configure a separate repository. As more tags are
identified and supported in the library in the future, the golden test files
will need to be updated to match.

The input files cover all four major MakerNote types supported by libexif and a
large proportion of the variants within those types.  The test files have had
their JPEG image data stripped out to make them smaller (which also makes them
noncompliant) but it's good enough for libexif to read the tags as well as some
other EXIF tools that don't care about the image.

Patch from Google.
2018-07-03 15:28:39 +02:00
Dan Fandrich 61b75034f4 Fixed some issues with truncating strings in exif_entry_get_value
If the buffer size provided forced the result to be truncated, the
truncation was not always properly performed. test-values.c was enhanced
to check proper truncation in a much wider variety of cases.
2018-06-01 19:42:45 +02:00
Dan Fandrich fe50f9b61a Fixed a handful of strange character encoding issues in comments 2018-01-31 22:31:11 +01:00
Marcus Meissner a881aa6387 also switch byte order, and also test saving 2017-07-26 17:30:19 +02:00
Marcus Meissner 1b040a06ad abort earlier 2017-07-26 00:04:17 +02:00
Marcus Meissner 94ebab3f13 add a test-fuzzer that can be used to be called by AFL that tries to
do various exif decoding on the passed file.
2017-07-24 15:20:58 +02:00
Dan Fandrich edcfe486fc Use the standard assert() function instead of rolling our own 2017-05-26 01:41:02 -07:00
Dan Fandrich a085e51792 Removed non-ASCII characters from the few source files that had them 2010-05-06 13:43:54 -07:00
Dan Fandrich 40dece1897 Use the new, clearer EXIF_DATA_TYPE_UNKNOWN definition. 2009-12-18 11:30:54 -08:00