diff -Nru exifprobe-2.0.1/aux/dump_section.c exifprobe-2.0.1+git20170416.3c2b769/aux/dump_section.c --- exifprobe-2.0.1/aux/dump_section.c 2005-07-24 22:57:36.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/aux/dump_section.c 2017-04-16 19:22:54.000000000 +0000 @@ -178,7 +178,7 @@ { if(show_bytes_decimal) { - fseek(ifp,start_offset,0); + fseek(ifp,start_offset,SEEK_SET); offset = start_offset; i = 0; printf("\n=============================================\nUnsigned byte - decimal:\n"); @@ -197,7 +197,7 @@ if(show_bytes_hex) { printf("\n=============================================\nUnsigned byte - hex:\n"); - fseek(ifp,start_offset,0); + fseek(ifp,start_offset,SEEK_SET); offset = start_offset; i = 0; while((offset <= end_offset) && !feof(ifp) && !ferror(ifp)) @@ -254,7 +254,7 @@ { if(show_long_decimal) { - fseek(ifp,start_offset,0); + fseek(ifp,start_offset,SEEK_SET); offset = start_offset; i = 0; printf("\n=============================================\nUnsigned long - decimal:\n"); @@ -273,7 +273,7 @@ } if(show_long_hex) { - fseek(ifp,start_offset,0); + fseek(ifp,start_offset,SEEK_SET); offset = start_offset; i = 0; printf("\n=============================================\nUnsigned long - hex:\n"); @@ -296,7 +296,7 @@ { if(show_long_rational) { - fseek(ifp,start_offset,0); + fseek(ifp,start_offset,SEEK_SET); offset = start_offset; i = 0; printf("\n=============================================\nUnsigned long - rational:\n"); @@ -319,7 +319,7 @@ } if(show_short_rational) { - fseek(ifp,start_offset,0); + fseek(ifp,start_offset,SEEK_SET); offset = start_offset; i = 0; printf("\n=============================================\nUnsigned short rational:\n"); @@ -363,7 +363,7 @@ { clearerr(inptr); curoffset = ftell(inptr); - if((offset != HERE) && (fseek(inptr,offset,0) == -1)) + if((offset != HERE) && (fseek(inptr,offset,SEEK_SET) == -1)) { printf(" SEEK FAILED to read unsigned short at offset "); printf("%lu",offset); @@ -405,7 +405,7 @@ { clearerr(inptr); curoffset = ftell(inptr); - if((offset != HERE) && (fseek(inptr,offset,0) == -1)) + if((offset != HERE) && (fseek(inptr,offset,SEEK_SET) == -1)) { printf(" SEEK FAILED to read unsigned 32bit integer at offset "); printf("%lu",offset); diff -Nru exifprobe-2.0.1/aux/extract_section.c exifprobe-2.0.1+git20170416.3c2b769/aux/extract_section.c --- exifprobe-2.0.1/aux/extract_section.c 2005-06-30 17:50:27.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/aux/extract_section.c 2017-04-16 19:22:54.000000000 +0000 @@ -104,7 +104,7 @@ perror("\tbecause"); exit(3); } - fseek(ifp,start_offset,0); + fseek(ifp,start_offset,SEEK_SET); if(sizeleft < COPYBUFSIZE) readsize = sizeleft; else diff -Nru exifprobe-2.0.1/aux/findjpeg.c exifprobe-2.0.1+git20170416.3c2b769/aux/findjpeg.c --- exifprobe-2.0.1/aux/findjpeg.c 2005-07-19 20:09:41.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/aux/findjpeg.c 2017-04-16 19:22:54.000000000 +0000 @@ -90,7 +90,7 @@ if((fp = fopen(filename,"r")) != (FILE *)0) { - fseek(fp,start_offset,0); + fseek(fp,start_offset,SEEK_SET); while(((highbyte = fgetc(fp)) != EOF) && (ftell(fp) <= end_offset)) { if(highbyte != 0xff) @@ -111,14 +111,14 @@ //printf(" %#02x ",highbyte); if(highbyte != 0xff) { - fseek(fp,-1L,1); + fseek(fp,-1L,SEEK_CUR); continue; } if(((lobyte = fgetc(fp)) != EOF) && (ftell(fp) <= end_offset)) { if((lobyte < 0xc0) || (lobyte > 0xfe)) continue; - fseek(fp,-2L,1); + fseek(fp,-2L,SEEK_CUR); if(tagloc == 0) soi_index = -1; ++soi_index; diff -Nru exifprobe-2.0.1/canon_extern.h exifprobe-2.0.1+git20170416.3c2b769/canon_extern.h --- exifprobe-2.0.1/canon_extern.h 2005-06-02 02:25:43.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/canon_extern.h 2017-04-16 19:22:54.000000000 +0000 @@ -48,6 +48,8 @@ unsigned long,unsigned long,int); extern unsigned long canon_sensorinfo(FILE *,unsigned short,char *, unsigned long,unsigned long,int); +extern unsigned long canon_aspectinfo(FILE *,unsigned short,char *, + unsigned long,unsigned long,int); extern unsigned long canon_pictureinfo(FILE *,unsigned short,char *, unsigned long,unsigned long,int); extern unsigned long canon_colorspace(FILE *,unsigned short,char *, diff -Nru exifprobe-2.0.1/CHANGES_2.0 exifprobe-2.0.1+git20170416.3c2b769/CHANGES_2.0 --- exifprobe-2.0.1/CHANGES_2.0 2005-07-25 21:34:01.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/CHANGES_2.0 2017-04-16 19:22:54.000000000 +0000 @@ -1,3 +1,24 @@ +2.1.0: +* Fix crashers: + - https://github.com/hfiguiere/exifprobe/issues/5 + - https://github.com/hfiguiere/exifprobe/issues/9 +* Fix infinite loop due to premature end-of-file + (Issue https://github.com/hfiguiere/exifprobe/issues/3) +* Fix and infinite recursion for the Interop IFD parsing. +* Fix other fuzzing crashers (https://github.com/hfiguiere/exifprobe/issues/2). +* Added SRAW Type and Slice tags for CR2 files. +* Fix build on Windows (Issue https://github.com/hfiguiere/exifprobe/pull/1) +* Fix EXIFPROBE_OPTIONS (https://github.com/hfiguiere/exifprobe/issues/8) +* Added basic parsing of Panasonic RAW and RW2 +* Updated DNG for 1.3 and 1.4 spec. +* Added Cinema DNG. +* Fixed RAF header parsing. +* Fix printing Software/Make/Model if it is less than 4 bytes (Found + in Sony and iPhone generated files). +* More Canon MakerNote decoding. +* Allow overriding CC at build time +* Various misc fixes. + 2.0.1: The following changes have been made since version 2.0.0: diff -Nru exifprobe-2.0.1/ciff.c exifprobe-2.0.1+git20170416.3c2b769/ciff.c --- exifprobe-2.0.1/ciff.c 2005-07-24 17:03:18.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/ciff.c 2017-04-16 19:22:54.000000000 +0000 @@ -60,7 +60,7 @@ heap_start = fileoffset_base + ciffheader->headerlength; if(heaplength) offset_table_end = fileoffset_base + heaplength; - else if(fseek(inptr,0L,2) == 0) + else if(fseek(inptr,0L,SEEK_END) == 0) offset_table_end = ftell(inptr); if(ferror(inptr) == 0) { @@ -223,7 +223,8 @@ else { print_tag_address(SECTION|ENTRY,max_dir_offset - 1,indent,"-"); - tablename = tablename ? tablename : QSTRING; + /* tablename is dynamically allocated */ + tablename = tablename ? tablename : strdup(QSTRING); chpr += printf("\n",tablename); print_tag_address(SECTION|ENTRY,end_offset - 4,indent,"-"); chpr += printf("%s location = @%lu",tablename,dircount_loc); @@ -1547,7 +1548,7 @@ int count = 0; int ch,lastch; - if((inptr) && (fseek(inptr,start_offset + 512,0) != -1)) + if((inptr) && (fseek(inptr,start_offset + 512,SEEK_SET) != -1)) { if(imagelength < maxcheck) maxcheck = imagelength; diff -Nru exifprobe-2.0.1/debian/changelog exifprobe-2.0.1+git20170416.3c2b769/debian/changelog --- exifprobe-2.0.1/debian/changelog 2017-06-11 13:11:53.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/debian/changelog 2017-07-08 22:36:23.000000000 +0000 @@ -1,15 +1,23 @@ -exifprobe (2.0.1-10fakesync1ubuntu1) artful; urgency=medium +exifprobe (2.0.1+git20170416.3c2b769-1) unstable; urgency=medium - * Cherrypick upstream commit to fix segfaults on corrupt jpeg files - (Closes: #809365). + * New upstream release: fixed crashes on corrupt file. (Closes: #809365) + * Updated my email address. + * debian/control: + - Bumped Standards-Version to 4.0.0. + * debian/copyright: updated the packaging copyright years. + * debian/patches: + - fix-issues-found-by-afl.patch: removed, the upstream fixed the + source code. Thanks. + - fix-makefile.patch: updated to improve GCC hardening. - -- Bhavani Shankar Sun, 11 Jun 2017 18:39:38 +0530 + -- Giovani Augusto Ferreira Sat, 08 Jul 2017 19:36:23 -0300 -exifprobe (2.0.1-10fakesync1) zesty-proposed; urgency=medium +exifprobe (2.0.1-11) unstable; urgency=medium - * Fake sync due to mismatching orig tarball. + * Update DH level to 10. + * debian/compat: updated to 10. - -- Colin Watson Sun, 06 Nov 2016 21:42:41 +0000 + -- Giovani Augusto Ferreira Fri, 16 Dec 2016 22:52:19 -0200 exifprobe (2.0.1-10) unstable; urgency=medium diff -Nru exifprobe-2.0.1/debian/compat exifprobe-2.0.1+git20170416.3c2b769/debian/compat --- exifprobe-2.0.1/debian/compat 2014-10-27 11:04:23.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/debian/compat 2016-12-17 00:52:19.000000000 +0000 @@ -1 +1 @@ -9 +10 diff -Nru exifprobe-2.0.1/debian/control exifprobe-2.0.1+git20170416.3c2b769/debian/control --- exifprobe-2.0.1/debian/control 2016-11-06 21:42:41.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/debian/control 2017-07-08 22:36:23.000000000 +0000 @@ -1,11 +1,10 @@ Source: exifprobe Section: graphics Priority: optional -Maintainer: Ubuntu Developers -XSBC-Original-Maintainer: Debian Forensics -Uploaders: Giovani Augusto Ferreira -Build-Depends: debhelper (>= 9), xutils-dev -Standards-Version: 3.9.8 +Maintainer: Debian Forensics +Uploaders: Giovani Augusto Ferreira +Build-Depends: debhelper (>= 10), xutils-dev +Standards-Version: 4.0.0 Homepage: https://github.com/hfiguiere/exifprobe Vcs-Browser: https://anonscm.debian.org/git/forensics/exifprobe.git Vcs-Git: https://anonscm.debian.org/git/forensics/exifprobe.git diff -Nru exifprobe-2.0.1/debian/copyright exifprobe-2.0.1+git20170416.3c2b769/debian/copyright --- exifprobe-2.0.1/debian/copyright 2016-02-22 21:40:10.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/debian/copyright 2017-07-08 22:36:23.000000000 +0000 @@ -9,7 +9,7 @@ Files: debian/* Copyright: 2007 Martin Albisetti 2014-2015 Joao Eriberto Mota Filho - 2016 Giovani Augusto Ferreira + 2016-2017 Giovani Augusto Ferreira License: GPL-3+ License: BSD-2-Clause diff -Nru exifprobe-2.0.1/debian/patches/fix-issues-found-by-afl.patch exifprobe-2.0.1+git20170416.3c2b769/debian/patches/fix-issues-found-by-afl.patch --- exifprobe-2.0.1/debian/patches/fix-issues-found-by-afl.patch 2015-05-28 22:24:08.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/debian/patches/fix-issues-found-by-afl.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,67 +0,0 @@ -Description: fix some issues found by Henri Sarlo, using AFL (American - Fuzzy Lop). Closes: #779525, #779527. -Author: Hubert Figuière -Last-Update: 2015-03-04 -Index: exifprobe-2.0.1/interpret.c -=================================================================== ---- exifprobe-2.0.1.orig/interpret.c -+++ exifprobe-2.0.1/interpret.c -@@ -75,7 +75,10 @@ interpret_value(struct ifd_entry *entry_ - print_compression(entry_ptr->value); - break; - case TIFFTAG_PhotometricInterpretation: -- print_photometric(entry_ptr->value,summary_entry->fileformat); -+ if (summary_entry) -+ { -+ print_photometric(entry_ptr->value,summary_entry->fileformat); -+ } - break; - case TIFFTAG_Orientation: - print_orientation(entry_ptr->value); -Index: exifprobe-2.0.1/misc.c -=================================================================== ---- exifprobe-2.0.1.orig/misc.c -+++ exifprobe-2.0.1/misc.c -@@ -303,10 +303,19 @@ scan_summary(struct image_summary *summa - if(summary_entry->bps[0] && summary_entry->spp) - { - int i; -+ int spp = summary_entry->spp; - float total_bits,bytes_per_pixel; - - total_bits = 0; -- for(i = 0; i < summary_entry->spp; ++i) -+ if (spp > MAXSAMPLE) -+ { -+ spp = MAXSAMPLE; -+ if(Debug & 0x4) -+ { -+ printf("CLAMPING spp\n"); -+ } -+ } -+ for(i = 0; i < spp; ++i) - total_bits += summary_entry->bps[i]; - bytes_per_pixel = total_bits / 8.0; - if(Debug & 0x4) -Index: exifprobe-2.0.1/process.c -=================================================================== ---- exifprobe-2.0.1.orig/process.c -+++ exifprobe-2.0.1/process.c -@@ -687,12 +687,16 @@ process_tiff_ifd(FILE *inptr,unsigned sh - case EXIFTAG_Interoperability: - /* This doesn't belong in a TIFF IFD, but */ - /* be prepared. */ -+ /* Also we make sure we are not calling on */ -+ /* the same ifd offset */ - PUSHCOLOR(INTEROP_COLOR); -- value_offset = process_tiff_ifd(inptr,byteorder, -+ if (entry_ptr->value != ifd_offset) { -+ value_offset = process_tiff_ifd(inptr,byteorder, - entry_ptr->value,fileoffset_base, - next_ifd_offset,summary_entry, - listname,INTEROP_IFD,ifdnum,0, - indent); -+ } - value_offset = 0; - POPCOLOR(); - break; diff -Nru exifprobe-2.0.1/debian/patches/fix-makefile.patch exifprobe-2.0.1+git20170416.3c2b769/debian/patches/fix-makefile.patch --- exifprobe-2.0.1/debian/patches/fix-makefile.patch 2014-10-27 17:29:07.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/debian/patches/fix-makefile.patch 2017-07-08 22:36:23.000000000 +0000 @@ -1,35 +1,37 @@ Description: makes Makefile compliant with Debian and add GCC hardening. Author: Martin Albisetti -Last-Update: 2007-06-13 - -Index: exifprobe-2.0.1/Makefile +Reviewed by: Giovani Augusto Ferreira +Last-Update: 2017-07-08 +Index: exifprobe-2.0.1+git20170416.3c2b769/Makefile =================================================================== ---- exifprobe-2.0.1.orig/Makefile -+++ exifprobe-2.0.1/Makefile -@@ -3,7 +3,7 @@ +--- exifprobe-2.0.1+git20170416.3c2b769.orig/Makefile ++++ exifprobe-2.0.1+git20170416.3c2b769/Makefile +@@ -3,7 +3,8 @@ # Any compiler should do - CC=cc --CFLAGS=-DCOLOR -O -+CFLAGS+=-DCOLOR -O + CC?=cc +-CFLAGS=-DCOLOR -O -std=c99 ++CFLAGS+=-fPIE -DCOLOR -O -std=c99 ++LDFLAGS+=-pie # You probably don't need these # CFLAGS=-DCOLOR -g -O -Dlint -Wall -Wno-long-long -@@ -22,9 +22,10 @@ CFLAGS=-DCOLOR -O +@@ -22,10 +23,10 @@ CFLAGS=-DCOLOR -O -std=c99 #CFLAGS += -DNATIVE_BYTEORDER_BIGENDIAN # or add to ./byteorder.h # On Solaris, you may need to use 'gmake', or edit the next line. -PREFIX ?= /usr/local -BINDIR=$(PREFIX)/bin -MANDIR=$(PREFIX)/man/man1 +- +INSTALL = install -d -m 644 +PREFIX ?= $(DESTDIR)/usr +BINDIR=$(PREFIX)/bin/local +MANDIR=$(PREFIX)/share/man/man1 - INCLUDES=defs.h extern.h misc.h tifftags.h exiftags.h \ -@@ -63,18 +64,21 @@ byteorder.h: + tiffeptags.h jpegtags.h global.h +@@ -63,18 +64,20 @@ byteorder.h: @echo veclib.o: lib/veclib.c @@ -53,7 +55,6 @@ + install -c -m 755 exifgrep $(PREFIX)/bin + install -c -m 644 exifprobe.1 $(PREFIX)/share/man/man1 + install -c -m 644 exifgrep.1 $(PREFIX)/share/man/man1 -+ # if you want HTML man pages, pick a target; I prefer man2html rman: exifprobe.1 exifgrep.1 diff -Nru exifprobe-2.0.1/debian/patches/fix_segfault_invalid_jpeg.patch exifprobe-2.0.1+git20170416.3c2b769/debian/patches/fix_segfault_invalid_jpeg.patch --- exifprobe-2.0.1/debian/patches/fix_segfault_invalid_jpeg.patch 2017-06-11 13:09:03.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/debian/patches/fix_segfault_invalid_jpeg.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,73 +0,0 @@ -From 3da9a77bf9eede9fbc9e9106ec45bdc941d78566 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Hubert=20Figui=C3=A8re?= -Date: Mon, 27 Feb 2017 11:58:49 -0500 -Subject: [PATCH] Bug #5 - Fix crashes on corrupt file - --read_bytes() now return NULL instead of static string --check for NULL string in find_makerscheme() and maker_number() - -Bugs https://github.com/hfiguiere/exifprobe/issues/5 and https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=809365 ---- - maker_generic.c | 18 +++++++++++------- - readfile.c | 2 +- - 2 files changed, 12 insertions(+), 8 deletions(-) - -diff --git a/maker_generic.c b/maker_generic.c -index 5cbab8f..9b7c951 100644 ---- a/maker_generic.c -+++ b/maker_generic.c -@@ -414,8 +414,9 @@ process_makernote(FILE *inptr,unsigned short byteorder, - if((value_offset < end_of_note) && (value_offset > max_value_offset)) - max_value_offset = value_offset; - } -- else if(value_offset > max_value_offset); -+ else if(value_offset > max_value_offset) { - max_value_offset = value_offset; -+ } - if((is_offset(entry_ptr) || maker_value_is_offset(entry_ptr,make,model))) - ++use_second_pass; - } -@@ -736,13 +737,16 @@ maker_number(char *make) - struct camera_name *maker_id; - int number = NO_MAKE; - -- /* 'Camera_make' is a global parameter */ -- for(maker_id = Camera_make; maker_id && maker_id->name; ++maker_id) -+ if(make) - { -- if(strncasecmp(make,maker_id->name,maker_id->namelen) == 0) -+ /* 'Camera_make' is a global parameter */ -+ for(maker_id = Camera_make; maker_id && maker_id->name; ++maker_id) - { -- number = maker_id->id; -- break; -+ if(strncasecmp(make,maker_id->name,maker_id->namelen) == 0) -+ { -+ number = maker_id->id; -+ break; -+ } - } - } - return(number); -@@ -952,7 +956,7 @@ find_makerscheme(FILE *inptr,unsigned long note_offset, - note_fileoffset = note_offset + fileoffset_base; - - id= (char *)read_bytes(inptr,MAX_IDLEN,note_fileoffset); -- length_read = strlen(id); -+ length_read = id ? strlen(id) : 0; - - /* check that string is printable, adjust id_length if nexessary */ - if(PRINT_SCHEME_DEBUG) -diff --git a/readfile.c b/readfile.c -index f7d9bdb..ad5a46c 100644 ---- a/readfile.c -+++ b/readfile.c -@@ -526,7 +526,7 @@ read_bytes(FILE *inptr,unsigned long nbytes,unsigned long offset) - { - static unsigned char rbuf[MAXBUFLEN]; - unsigned long curoffset; -- unsigned char *value = (unsigned char *)NULLSTRING; -+ unsigned char *value = NULL; - int chpr = 0; - - memset(rbuf,0,MAXBUFLEN); diff -Nru exifprobe-2.0.1/debian/patches/fix_spelling_error.patch exifprobe-2.0.1+git20170416.3c2b769/debian/patches/fix_spelling_error.patch --- exifprobe-2.0.1/debian/patches/fix_spelling_error.patch 2016-03-21 01:55:24.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/debian/patches/fix_spelling_error.patch 2017-07-08 22:36:23.000000000 +0000 @@ -1,12 +1,12 @@ Description: fix a spelling error in some files. Author: Joao Eriberto Mota Filho - Giovani Augusto Ferreira -Last-Update: 2016-03-20 -Index: exifprobe-2.0.1/maker_agfa.c -=================================================================== ---- exifprobe-2.0.1.orig/maker_agfa.c -+++ exifprobe-2.0.1/maker_agfa.c -@@ -394,7 +394,7 @@ agfa1_interpret_offset_makervalue(FILE * + Giovani Augusto Ferreira +Last-Update: 2017-07-08 +Index: exifprobe-2.0.1+git20170416.3c2b769/maker_agfa.c +=================================================================== +--- exifprobe-2.0.1+git20170416.3c2b769.orig/maker_agfa.c ++++ exifprobe-2.0.1+git20170416.3c2b769/maker_agfa.c +@@ -395,7 +395,7 @@ agfa1_interpret_offset_makervalue(FILE * switch(value) { case 0: chpr += printf("Normal"); break; @@ -15,11 +15,11 @@ case 2: chpr += printf("Fast"); break; case 3: chpr += printf("Panorama,"); value = read_ulong(inptr,byteorder,HERE); -Index: exifprobe-2.0.1/maker_epson.c +Index: exifprobe-2.0.1+git20170416.3c2b769/maker_epson.c =================================================================== ---- exifprobe-2.0.1.orig/maker_epson.c -+++ exifprobe-2.0.1/maker_epson.c -@@ -508,7 +508,7 @@ epson1_interpret_offset_makervalue(FILE +--- exifprobe-2.0.1+git20170416.3c2b769.orig/maker_epson.c ++++ exifprobe-2.0.1+git20170416.3c2b769/maker_epson.c +@@ -509,7 +509,7 @@ epson1_interpret_offset_makervalue(FILE switch(value) { case 0: chpr += printf("Normal"); break; @@ -28,11 +28,11 @@ case 2: chpr += printf("Fast"); break; case 3: chpr += printf("Panorama,"); value = read_ulong(inptr,byteorder,HERE); -Index: exifprobe-2.0.1/maker_minolta.c +Index: exifprobe-2.0.1+git20170416.3c2b769/maker_minolta.c =================================================================== ---- exifprobe-2.0.1.orig/maker_minolta.c -+++ exifprobe-2.0.1/maker_minolta.c -@@ -596,7 +596,7 @@ minolta1_interpret_offset_makervalue(FIL +--- exifprobe-2.0.1+git20170416.3c2b769.orig/maker_minolta.c ++++ exifprobe-2.0.1+git20170416.3c2b769/maker_minolta.c +@@ -597,7 +597,7 @@ minolta1_interpret_offset_makervalue(FIL switch(value) { case 0: chpr += printf("Normal"); break; @@ -41,11 +41,11 @@ case 2: chpr += printf("Fast"); break; case 3: chpr += printf("Panorama,"); value = read_ulong(inptr,byteorder,HERE); -Index: exifprobe-2.0.1/maker_olympus.c +Index: exifprobe-2.0.1+git20170416.3c2b769/maker_olympus.c =================================================================== ---- exifprobe-2.0.1.orig/maker_olympus.c -+++ exifprobe-2.0.1/maker_olympus.c -@@ -464,7 +464,7 @@ olympus1_interpret_offset_makervalue(FIL +--- exifprobe-2.0.1+git20170416.3c2b769.orig/maker_olympus.c ++++ exifprobe-2.0.1+git20170416.3c2b769/maker_olympus.c +@@ -465,7 +465,7 @@ olympus1_interpret_offset_makervalue(FIL switch(value) { case 0: chpr += printf("Normal"); break; @@ -54,11 +54,11 @@ case 2: chpr += printf("Fast"); break; case 3: chpr += printf("Panorama,"); value = read_ulong(inptr,byteorder,HERE); -Index: exifprobe-2.0.1/maker_sanyo.c +Index: exifprobe-2.0.1+git20170416.3c2b769/maker_sanyo.c =================================================================== ---- exifprobe-2.0.1.orig/maker_sanyo.c -+++ exifprobe-2.0.1/maker_sanyo.c -@@ -605,7 +605,7 @@ sanyo1_interpret_offset_makervalue(FILE +--- exifprobe-2.0.1+git20170416.3c2b769.orig/maker_sanyo.c ++++ exifprobe-2.0.1+git20170416.3c2b769/maker_sanyo.c +@@ -606,7 +606,7 @@ sanyo1_interpret_offset_makervalue(FILE switch(value) { case 0: chpr += printf("Normal"); break; @@ -67,11 +67,11 @@ case 2: chpr += printf("Fast"); break; case 3: chpr += printf("Panorama,"); value = read_ulong(inptr,byteorder,HERE); -Index: exifprobe-2.0.1/misc.c +Index: exifprobe-2.0.1+git20170416.3c2b769/misc.c =================================================================== ---- exifprobe-2.0.1.orig/misc.c -+++ exifprobe-2.0.1/misc.c -@@ -853,7 +853,7 @@ tiff_compression_string(unsigned long co +--- exifprobe-2.0.1+git20170416.3c2b769.orig/misc.c ++++ exifprobe-2.0.1+git20170416.3c2b769/misc.c +@@ -887,7 +887,7 @@ tiff_compression_string(unsigned long co /* will be 0 only if compression tag does not appear */ case 0: compression = "unknown format"; break; case 1: compression = "uncompressed"; break; /* TIFF6/TIFF_EP */ diff -Nru exifprobe-2.0.1/debian/patches/series exifprobe-2.0.1+git20170416.3c2b769/debian/patches/series --- exifprobe-2.0.1/debian/patches/series 2017-06-11 13:09:34.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/debian/patches/series 2017-07-08 22:36:23.000000000 +0000 @@ -1,8 +1,6 @@ -fix-issues-found-by-afl.patch fix-exifgrep.patch fix-manpages.patch fix_spelling_error.patch add_byteorder.patch fix-makefile.patch fix-embed-build-time.patch -fix_segfault_invalid_jpeg.patch diff -Nru exifprobe-2.0.1/dngtags.h exifprobe-2.0.1+git20170416.3c2b769/dngtags.h --- exifprobe-2.0.1/dngtags.h 2005-07-12 18:25:13.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/dngtags.h 2017-04-16 19:22:54.000000000 +0000 @@ -64,4 +64,64 @@ #define DNGTAG_CurrentICCProfile 0xC691 /* 50833 */ #define DNGTAG_CurrentPreProfileMatrix 0xC692 /* 50834 */ +/* DNG 1.2.0 */ + +#define DNGTAG_ColorimetricReference 0xC6BF /* 50879 */ +#define DNGTAG_CameraCalibrationSignature 0xC6F3 /* 50931 */ +#define DNGTAG_ProfileCalibrationSignature 0xC6F4 /* 50932 */ +#define DNGTAG_ExtraCameraProfiles 0xC6F5 /* 50933 */ +#define DNGTAG_AsShotProfileName 0xC6F6 /* 50934 */ +#define DNGTAG_NoiseReductionApplied 0xC6F7 /* 50935 */ +#define DNGTAG_ProfileName 0xC6F8 /* 50936 */ +#define DNGTAG_ProfileHueSatMapDims 0xC6F9 /* 50937 */ +#define DNGTAG_ProfileHueSatMapData1 0xC6FA /* 50938 */ +#define DNGTAG_ProfileHueSatMapData2 0xC6FB /* 50939 */ +#define DNGTAG_ProfileToneCurve 0xC6FC /* 50940 */ +#define DNGTAG_ProfileEmbedPolicy 0xC6FD /* 50941 */ +#define DNGTAG_ProfileCopyright 0xC6FE /* 50942 */ + +#define DNGTAG_ForwardMatrix1 0xC714 /* 50964 */ +#define DNGTAG_ForwardMatrix2 0xC715 /* 50965 */ +#define DNGTAG_PreviewApplicationName 0xC716 /* 50966 */ +#define DNGTAG_PreviewApplicationVersion 0xC717 /* 50967 */ +#define DNGTAG_PreviewSettingsName 0xC718 /* 50968 */ +#define DNGTAG_PreviewPreviewSettingsDigest 0xC719 /* 50969 */ +#define DNGTAG_PreviewPreviewColorSpace 0xC71A /* 50970 */ +#define DNGTAG_PreviewPreviewDateTime 0xC71B /* 50971 */ +#define DNGTAG_RawImageDigest 0xC71C /* 50972 */ +#define DNGTAG_OriginalRawFileDigest 0xC71D /* 50973 */ +#define DNGTAG_SubTileBlockSize 0xC71E /* 50974 */ +#define DNGTAG_RowInterleaveFactor 0xC71F /* 50975 */ +#define DNGTAG_ProfileLookTableDims 0xC725 /* 50981 */ +#define DNGTAG_ProfileLookTableData 0xC726 /* 50982 */ + + +/* DNG 1.3.0 */ + +#define DNGTAG_OpcodeList1 0xC740 /* 51008 */ +#define DNGTAG_OpcodeList2 0xC741 /* 51009 */ +#define DNGTAG_OpcodeList3 0xC74E /* 51022 */ +#define DNGTAG_NoiseProfile 0xC761 /* 51041 */ + +/* Cinema DNG */ + +#define DNGTAG_TimeCodes 0xC763 /* 51043 */ +#define DNGTAG_FrameRate 0xC764 /* 51044 */ +#define DNGTAG_TStop 0xC772 /* 51058 */ +#define DNGTAG_ReelName 0xC789 /* 51081 */ +#define DNGTAG_CameraLabel 0xC7A1 /* 51105 */ + +/* DNG 1.4.0 */ + +#define DNGTAG_OriginalDefaultFinalSize 0xC791 /* 51089 */ +#define DNGTAG_OriginalBestQualityFinalSize 0xC792 /* 51090 */ +#define DNGTAG_OriginalDefaultCropSize 0xC793 /* 51091 */ +#define DNGTAG_ProfileHueSatMapEncoding 0xC7A3 /* 51107 */ +#define DNGTAG_ProfileLookTableEncoding 0xC7A4 /* 51108 */ +#define DNGTAG_BaselineExposureOffset 0xC7A5 /* 51109 */ +#define DNGTAG_DefaultBlackRender 0xC7A6 /* 51110 */ +#define DNGTAG_NewRawImageDigest 0xC7A7 /* 51111 */ +#define DNGTAG_RawToPreviewGain 0xC7A8 /* 51112 */ +#define DNGTAG_DefaultUserCrop 0xC7B5 /* 51125 */ + #endif /* DNGTAGS_INCLUDED */ diff -Nru exifprobe-2.0.1/.gitignore exifprobe-2.0.1+git20170416.3c2b769/.gitignore --- exifprobe-2.0.1/.gitignore 1970-01-01 00:00:00.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/.gitignore 2017-04-16 19:22:54.000000000 +0000 @@ -0,0 +1,4 @@ +*.o +byteorder.h +comptime.c +exifprobe \ No newline at end of file diff -Nru exifprobe-2.0.1/interpret.c exifprobe-2.0.1+git20170416.3c2b769/interpret.c --- exifprobe-2.0.1/interpret.c 2005-07-24 21:26:04.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/interpret.c 2017-04-16 19:22:54.000000000 +0000 @@ -75,7 +75,10 @@ print_compression(entry_ptr->value); break; case TIFFTAG_PhotometricInterpretation: - print_photometric(entry_ptr->value,summary_entry->fileformat); + if (summary_entry) + { + print_photometric(entry_ptr->value,summary_entry->fileformat); + } break; case TIFFTAG_Orientation: print_orientation(entry_ptr->value); diff -Nru exifprobe-2.0.1/jp2000.c exifprobe-2.0.1+git20170416.3c2b769/jp2000.c --- exifprobe-2.0.1/jp2000.c 2005-07-24 19:54:04.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/jp2000.c 2017-04-16 19:22:54.000000000 +0000 @@ -453,7 +453,7 @@ print_tag_address(VALUE,dataoffset,indent + 10,"="); if((PRINT_VALUE)) { - if((inptr && (fseek(inptr,dataoffset,0)) != -1)) + if((inptr && (fseek(inptr,dataoffset,SEEK_SET)) != -1)) { while(size > 0ULL) { @@ -503,7 +503,7 @@ { print_tag_address(SECTION,dataoffset,indent + 8,"="); size = boxlength - 8; - if((inptr && (fseek(inptr,dataoffset,0)) != -1)) + if((inptr && (fseek(inptr,dataoffset,SEEK_SET)) != -1)) { while(size > 0ULL) { diff -Nru exifprobe-2.0.1/LICENSE.EXIFPROBE exifprobe-2.0.1+git20170416.3c2b769/LICENSE.EXIFPROBE --- exifprobe-2.0.1/LICENSE.EXIFPROBE 2005-01-30 17:15:57.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/LICENSE.EXIFPROBE 2017-04-16 19:22:54.000000000 +0000 @@ -2,6 +2,8 @@ All of the files included in the EXIFPROBE distribution are: Copyright (C) 2005 by Duane H. Hesser. All rights reserved. +Portions: + Copyright (C) 2011-2014 by Hubert Figuiere. Some individual files may be covered by other copyrights. @@ -28,4 +30,5 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -Author: dhh@virtual-cafe.com +Authors: Duane H. Hesser + Hubert Figuière diff -Nru exifprobe-2.0.1/main.c exifprobe-2.0.1+git20170416.3c2b769/main.c --- exifprobe-2.0.1/main.c 2005-07-24 15:58:05.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/main.c 2017-04-16 19:22:54.000000000 +0000 @@ -83,7 +83,7 @@ while((file = *argv++)) { - inptr = fopen(file,"r"); + inptr = fopen(file,"rb"); if(inptr == FNULL) { fprintf(stderr,"%s: failed to open file %s\n",Progname,file); @@ -107,7 +107,7 @@ } else if(Start_offset) { - if(fseek(inptr,Start_offset,0) == -1) + if(fseek(inptr,Start_offset,SEEK_SET) == -1) { fprintf(stderr,"%s: FAILED to seek to start offset %lu\n", Progname,Start_offset); @@ -148,6 +148,7 @@ { case ORF1_MAGIC: case ORF2_MAGIC: + case RW2_MAGIC: case TIFF_MAGIC: ifd_offset = read_ulong(inptr,header->file_marker,HERE); if(ifd_offset > filesize) @@ -178,6 +179,9 @@ case ORF2_MAGIC: name = "ORF2"; break; + case RW2_MAGIC: + name = "RW2"; + break; case TIFF_MAGIC: default: break; @@ -261,7 +265,7 @@ } if(status == 0) { - max_offset = process_raf(inptr,Start_offset + 48,summary_entry,"RAF",0L); + max_offset = process_raf(inptr,Start_offset + 60,summary_entry,"RAF",0L); if(max_offset > 0L) status = 0; } diff -Nru exifprobe-2.0.1/Makefile exifprobe-2.0.1+git20170416.3c2b769/Makefile --- exifprobe-2.0.1/Makefile 2005-07-25 22:15:49.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/Makefile 2017-04-16 19:22:54.000000000 +0000 @@ -2,8 +2,8 @@ # Makefile for EXIFPROBE image file probe # Any compiler should do -CC=cc -CFLAGS=-DCOLOR -O +CC?=cc +CFLAGS=-DCOLOR -O -std=c99 # You probably don't need these # CFLAGS=-DCOLOR -g -O -Dlint -Wall -Wno-long-long diff -Nru exifprobe-2.0.1/maker_agfa.c exifprobe-2.0.1+git20170416.3c2b769/maker_agfa.c --- exifprobe-2.0.1/maker_agfa.c 2005-07-24 22:56:26.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/maker_agfa.c 2017-04-16 19:22:54.000000000 +0000 @@ -20,6 +20,7 @@ #include #include +#include #include #include "defs.h" #include "summary.h" @@ -222,7 +223,7 @@ } /* make certain we're at the end */ clearerr(inptr); - fseek(inptr,value_offset + count,0); + fseek(inptr,value_offset + count,SEEK_SET); break; case 0x0f00: /* Data */ if(at_offset && (PRINT_ENTRY)) @@ -257,7 +258,7 @@ chpr += printf(" # UNDEFINED"); } /* make certain we're at the end */ - fseek(inptr,value_offset + count,0); + fseek(inptr,value_offset + count,SEEK_SET); break; default: print_generic_offset_makervalue(inptr,byteorder,entry_ptr, diff -Nru exifprobe-2.0.1/maker_asahi.c exifprobe-2.0.1+git20170416.3c2b769/maker_asahi.c --- exifprobe-2.0.1/maker_asahi.c 2005-07-24 22:56:26.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/maker_asahi.c 2017-04-16 19:22:54.000000000 +0000 @@ -28,6 +28,7 @@ #include #include +#include #include #include "defs.h" #include "datadefs.h" @@ -297,7 +298,7 @@ } /* make certain we're at the end */ clearerr(inptr); - fseek(inptr,value_offset + count,0); + fseek(inptr,value_offset + count,SEEK_SET); break; case 0x0e00: /* PrintIM (Epson Print Image matching) */ if(!at_offset && (PRINT_VALUE)) @@ -403,7 +404,7 @@ } /* make certain we're at the end */ clearerr(inptr); - fseek(inptr,value_offset + count,0); + fseek(inptr,value_offset + count,SEEK_SET); break; case 0x0e00: /* PrintIM (Epson Print Image matching) */ if(!at_offset && (PRINT_VALUE)) diff -Nru exifprobe-2.0.1/maker_canon.c exifprobe-2.0.1+git20170416.3c2b769/maker_canon.c --- exifprobe-2.0.1/maker_canon.c 2005-07-24 22:56:26.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/maker_canon.c 2017-04-16 19:22:54.000000000 +0000 @@ -25,6 +25,7 @@ #include #include #include +#include #include #include "defs.h" @@ -435,6 +436,35 @@ } clearerr(inptr); break; + case 0x009a: /* AspectInfo */ + if(at_offset) + { + if((PRINT_SECTION)) + { + print_tag_address(SECTION,value_offset,indent,prefix); + chpr += printf("<%s> ",nameoftag); + chpr += printf("%lu entries",entry_ptr->count - 1); + } + } + else if((PRINT_VALUE)) + chpr += printf("\'%lu entries\'",entry_ptr->count - 1); + if((PRINT_LONGNAMES)) + tagprefix = fulldirname; + else + tagprefix = nameoftag; + setcharsprinted(chpr); + chpr = 0; + (void)canon_aspectinfo(inptr,byteorder,tagprefix,value_offset, + entry_ptr->count * sizeof(long), + indent + MEDIUMINDENT); + if(PRINT_SECTION) + { + print_tag_address(SECTION,value_offset + (entry_ptr->count * 2) - 1, + indent,prefix); + chpr += printf(" ",nameoftag); + } + break; + default: print_generic_offset_makervalue(inptr,byteorder,entry_ptr,fileoffset_base, fulldirname,prefix,indent, @@ -514,12 +544,18 @@ case 0x0009: tagname = "OwnerName"; break; case 0x000a: tagname = "ColorInfoD30*"; break; case 0x000c: tagname = "CameraSerialNo"; break; + case 0x000d: tagname = "CameraInfo"; break; case 0x000e: tagname = "FileLength"; break; case 0x000f: tagname = "CustomFunctions"; break; + case 0x0010: tagname = "UniqueModelId"; break; /* from dcraw */ case 0x0012: tagname = "PictureInfo"; break; + case 0x0013: tagname = "ThumbnailImageValidArea"; break; case 0x0081: tagname = "JpegImage"; break; case 0x0090: tagname = "CustomFunctions"; break; case 0x0093: tagname = "FileInfo**"; break; /* exiftool shows wrong type */ + case 0x0095: tagname = "LensName"; break; + case 0x0098: tagname = "CropInfo"; break; + case 0x009a: tagname = "AspectInfo"; break; case 0x00a0: tagname = "ColorInfo**"; break; /* exiftool - wrong # values */ case 0x00a9: tagname = "WhiteBalanceTable"; break; case 0x00ae: tagname = "ColorTemperature"; break; @@ -2984,7 +3020,7 @@ if((PRINT_VALUE)) chpr += printf(" = %u",value); break; - case 7: + case 7: if((PRINT_TAGINFO)) chpr += printf(".%02d_%-26.26s",i,"SensorRightBorder"); if((PRINT_VALUE)) @@ -2996,6 +3032,130 @@ if((PRINT_VALUE)) chpr += printf(" = %u",value); break; + case 9: + if((PRINT_TAGINFO)) + chpr += printf(".%02d_%-26.26s",i,"BlackMaskLeftBorder"); + if((PRINT_VALUE)) + chpr += printf(" = %u",value); + break; + case 10: + if((PRINT_TAGINFO)) + chpr += printf(".%02d_%-26.26s",i,"BlackMaskTopBorder"); + if((PRINT_VALUE)) + chpr += printf(" = %u",value); + break; + case 11: + if((PRINT_TAGINFO)) + chpr += printf(".%02d_%-26.26s",i,"BlackMaskRightBorder"); + if((PRINT_VALUE)) + chpr += printf(" = %u",value); + break; + case 12: + if((PRINT_TAGINFO)) + chpr += printf(".%02d_%-26.26s",i,"BlackMaskBottomBorder"); + if((PRINT_VALUE)) + chpr += printf(" = %u",value); + break; + default: + if((PRINT_TAGINFO)) + chpr += printf(".%02d_%-26.26s",i,"Undefined"); + if((PRINT_VALUE)) + chpr += printf(" = %#x%u",value,value); + break; + } + chpr = newline(chpr); + } + } + setcharsprinted(chpr); + return(end_offset); +} + + +unsigned long +canon_aspectinfo(FILE *inptr,unsigned short byteorder,char *tagprefix, + unsigned long offset,unsigned long dirlength,int indent) +{ + unsigned long count; + unsigned long end_offset; + unsigned long value; + int i; + int chpr = 0; + + end_offset = offset + dirlength; + if(PRINT_SECTION) + { + chpr += printf(" length %lu",dirlength); + } + chpr = newline(chpr); + + if((PRINT_ENTRY)) + { + count = (dirlength / sizeof(long)); + + for(i = 0; i <= count; ++i) + { + value = read_ulong(inptr,byteorder,offset); + print_tag_address(ENTRY,offset,indent,"@"); + if((PRINT_TAGINFO)) + chpr += printf("%s",tagprefix); + offset += 4; + switch(i) + { + case 0: + if((PRINT_TAGINFO)) + chpr += printf(".%02d_%-26.26s",i,"AspectRatio"); + if((PRINT_VALUE)) + chpr += printf(" = %#lx",value); + + print_startvalue(); + switch(value) + { + case 0: + chpr += printf("3:2"); + break; + case 1: + chpr += printf("1:1"); + break; + case 2: + chpr += printf("4:3"); + break; + case 7: + chpr += printf("16:9"); + break; + case 8: + chpr += printf("4:5"); + break; + default: + printred("undefined"); + break; + } + print_endvalue(); + + break; + case 1: + if((PRINT_TAGINFO)) + chpr += printf(".%02d_%-26.26s",i,"CroppedImageWidth"); + if((PRINT_VALUE)) + chpr += printf(" = %lu",value); + break; + case 2: + if((PRINT_TAGINFO)) + chpr += printf(".%02d_%-26.26s",i,"CroppedImageHeight"); + if((PRINT_VALUE)) + chpr += printf(" = %lu",value); + break; + case 3: + if((PRINT_TAGINFO)) + chpr += printf(".%02d_%-26.26s",i,"CroppedImageLeft"); + if((PRINT_VALUE)) + chpr += printf(" = %lu",value); + break; + case 4: + if((PRINT_TAGINFO)) + chpr += printf(".%02d_%-26.26s",i,"CroppedImageRight"); + if((PRINT_VALUE)) + chpr += printf(" = %lu",value); + break; default: if((PRINT_TAGINFO)) chpr += printf(".%02d_%-26.26s",i,"Undefined"); diff -Nru exifprobe-2.0.1/maker_casio.c exifprobe-2.0.1+git20170416.3c2b769/maker_casio.c --- exifprobe-2.0.1/maker_casio.c 2005-07-24 22:56:26.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/maker_casio.c 2017-04-16 19:22:54.000000000 +0000 @@ -28,6 +28,7 @@ #include #include +#include #include #include "defs.h" #include "datadefs.h" @@ -363,7 +364,7 @@ } /* make certain we're at the end */ clearerr(inptr); - fseek(inptr,value_offset + count,0); + fseek(inptr,value_offset + count,SEEK_SET); break; case 0x0e00: /* PrintIM (Epson Print Image matching) */ nameoftag = maker_tagname(entry_ptr->tag,make,model); diff -Nru exifprobe-2.0.1/maker_epson.c exifprobe-2.0.1+git20170416.3c2b769/maker_epson.c --- exifprobe-2.0.1/maker_epson.c 2005-07-24 22:56:26.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/maker_epson.c 2017-04-16 19:22:54.000000000 +0000 @@ -23,6 +23,7 @@ #include #include +#include #include #include "defs.h" #include "datadefs.h" @@ -303,7 +304,7 @@ } /* make certain we're at the end */ clearerr(inptr); - fseek(inptr,value_offset + count,0); + fseek(inptr,value_offset + count,SEEK_SET); break; case 0x0e00: /* PrintIM (Epson Print Image matching) */ if(!at_offset && (PRINT_VALUE)) @@ -350,7 +351,7 @@ chpr += printf(" # UNDEFINED"); } /* make certain we're at the end */ - fseek(inptr,value_offset + count,0); + fseek(inptr,value_offset + count,SEEK_SET); break; default: print_generic_offset_makervalue(inptr,byteorder,entry_ptr, diff -Nru exifprobe-2.0.1/maker_fujifilm.c exifprobe-2.0.1+git20170416.3c2b769/maker_fujifilm.c --- exifprobe-2.0.1/maker_fujifilm.c 2005-07-24 22:56:26.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/maker_fujifilm.c 2017-04-16 19:22:54.000000000 +0000 @@ -20,6 +20,7 @@ #include #include +#include #include "defs.h" #include "datadefs.h" #include "maker_datadefs.h" @@ -179,6 +180,7 @@ switch(tag) { case 0x0000: tagname = "Version"; break; + case 0x0010: tagname = "UniqueSerial"; break; /* Exiv2 */ case 0x1000: tagname = "Quality"; break; case 0x1001: tagname = "Sharpness"; break; case 0x1002: tagname = "WhiteBalance"; break; @@ -194,6 +196,15 @@ case 0x1300: tagname = "BlurWarning"; break; case 0x1301: tagname = "FocusWarning"; break; case 0x1302: tagname = "AEWarning"; break; + + case 0x1401: tagname = "FilmMode"; break; /* Exiv2 */ + case 0x1402: tagname = "DynamicRangeSettings"; break; /* Exiv2 */ + case 0x1403: tagname = "DevelopmentDynamicRange"; break; /* Exiv2 */ + + case 0x1404: tagname = "FocalLengthMin"; break; + case 0x1405: tagname = "FocalLengthMax"; break; + case 0x1406: tagname = "MaxApertureAtMinFocal"; break; + case 0x1407: tagname = "MaxApertureAtMaxFocal"; break; default: break; } setnotetagset(1); diff -Nru exifprobe-2.0.1/maker_generic.c exifprobe-2.0.1+git20170416.3c2b769/maker_generic.c --- exifprobe-2.0.1/maker_generic.c 2005-07-24 21:34:37.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/maker_generic.c 2017-04-16 19:22:54.000000000 +0000 @@ -16,6 +16,7 @@ #include #include +#include #include #include @@ -413,8 +414,9 @@ if((value_offset < end_of_note) && (value_offset > max_value_offset)) max_value_offset = value_offset; } - else if(value_offset > max_value_offset); + else if(value_offset > max_value_offset) { max_value_offset = value_offset; + } if((is_offset(entry_ptr) || maker_value_is_offset(entry_ptr,make,model))) ++use_second_pass; } @@ -735,13 +737,16 @@ struct camera_name *maker_id; int number = NO_MAKE; - /* 'Camera_make' is a global parameter */ - for(maker_id = Camera_make; maker_id && maker_id->name; ++maker_id) + if(make) { - if(strncasecmp(make,maker_id->name,maker_id->namelen) == 0) + /* 'Camera_make' is a global parameter */ + for(maker_id = Camera_make; maker_id && maker_id->name; ++maker_id) { - number = maker_id->id; - break; + if(strncasecmp(make,maker_id->name,maker_id->namelen) == 0) + { + number = maker_id->id; + break; + } } } return(number); @@ -951,7 +956,7 @@ note_fileoffset = note_offset + fileoffset_base; id= (char *)read_bytes(inptr,MAX_IDLEN,note_fileoffset); - length_read = strlen(id); + length_read = id ? strlen(id) : 0; /* check that string is printable, adjust id_length if nexessary */ if(PRINT_SCHEME_DEBUG) diff -Nru exifprobe-2.0.1/maker_hp.c exifprobe-2.0.1+git20170416.3c2b769/maker_hp.c --- exifprobe-2.0.1/maker_hp.c 2005-07-24 22:56:26.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/maker_hp.c 2017-04-16 19:22:54.000000000 +0000 @@ -12,6 +12,7 @@ #include #include +#include #include "defs.h" #include "datadefs.h" #include "maker_datadefs.h" diff -Nru exifprobe-2.0.1/maker_kodak.c exifprobe-2.0.1+git20170416.3c2b769/maker_kodak.c --- exifprobe-2.0.1/maker_kodak.c 2005-07-24 22:56:26.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/maker_kodak.c 2017-04-16 19:22:54.000000000 +0000 @@ -12,6 +12,7 @@ #include #include +#include #include "datadefs.h" #include "maker_datadefs.h" #include "summary.h" diff -Nru exifprobe-2.0.1/maker_konica.c exifprobe-2.0.1+git20170416.3c2b769/maker_konica.c --- exifprobe-2.0.1/maker_konica.c 2005-07-24 22:56:26.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/maker_konica.c 2017-04-16 19:22:54.000000000 +0000 @@ -20,6 +20,7 @@ #include #include +#include #include #include "defs.h" #include "datadefs.h" diff -Nru exifprobe-2.0.1/maker_kyocera.c exifprobe-2.0.1+git20170416.3c2b769/maker_kyocera.c --- exifprobe-2.0.1/maker_kyocera.c 2005-07-24 22:56:26.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/maker_kyocera.c 2017-04-16 19:22:54.000000000 +0000 @@ -16,6 +16,7 @@ #include #include +#include #include #include "defs.h" #include "datadefs.h" diff -Nru exifprobe-2.0.1/maker_leica.c exifprobe-2.0.1+git20170416.3c2b769/maker_leica.c --- exifprobe-2.0.1/maker_leica.c 2005-07-24 22:56:26.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/maker_leica.c 2017-04-16 19:22:54.000000000 +0000 @@ -24,6 +24,7 @@ #include #include +#include #include "defs.h" #include "datadefs.h" #include "maker_datadefs.h" diff -Nru exifprobe-2.0.1/maker_minolta.c exifprobe-2.0.1+git20170416.3c2b769/maker_minolta.c --- exifprobe-2.0.1/maker_minolta.c 2005-07-24 21:57:28.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/maker_minolta.c 2017-04-16 19:22:54.000000000 +0000 @@ -29,6 +29,7 @@ #include #include +#include #include #include "defs.h" #include "datadefs.h" @@ -294,7 +295,7 @@ } /* make certain we're at the end */ clearerr(inptr); - fseek(inptr,value_offset + count,0); + fseek(inptr,value_offset + count,SEEK_SET); break; case 0x0e00: /* PrintIM */ if(!at_offset && (PRINT_VALUE)) @@ -341,7 +342,7 @@ chpr += printf(" # UNDEFINED"); } /* make certain we're at the end */ - fseek(inptr,value_offset + count,0); + fseek(inptr,value_offset + count,SEEK_SET); break; default: print_generic_offset_makervalue(inptr,byteorder,entry_ptr, diff -Nru exifprobe-2.0.1/maker_nikon.c exifprobe-2.0.1+git20170416.3c2b769/maker_nikon.c --- exifprobe-2.0.1/maker_nikon.c 2005-07-24 22:56:26.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/maker_nikon.c 2017-04-16 19:22:54.000000000 +0000 @@ -44,6 +44,7 @@ #include #include +#include #include #include #include "defs.h" @@ -270,7 +271,7 @@ } /* make certain we're at the end */ clearerr(inptr); - fseek(inptr,value_offset + count,0); + fseek(inptr,value_offset + count,SEEK_SET); break; case 0x0f00: /* Data */ if(at_offset && (PRINT_ENTRY)) @@ -305,7 +306,7 @@ chpr = newline(1); } /* make certain we're at the end */ - fseek(inptr,value_offset + count,0); + fseek(inptr,value_offset + count,SEEK_SET); break; default: print_generic_offset_makervalue(inptr,byteorder,entry_ptr, @@ -454,7 +455,7 @@ } /* make certain we're at the end unless 'inptr' bad */ clearerr(inptr); - fseek(inptr,value_offset + count,0); + fseek(inptr,value_offset + count,SEEK_SET); break; case 0x0e00: /* PrintIM (Epson Print Image matching) */ if(!at_offset && (PRINT_VALUE)) @@ -501,7 +502,7 @@ chpr = newline(1); } /* make certain we're at the end */ - fseek(inptr,value_offset + count,0); + fseek(inptr,value_offset + count,SEEK_SET); break; case 0x0097: /* Color Balance ???? */ /* Most models show this as an UNDEFINED section; the */ diff -Nru exifprobe-2.0.1/maker_olympus.c exifprobe-2.0.1+git20170416.3c2b769/maker_olympus.c --- exifprobe-2.0.1/maker_olympus.c 2005-07-24 22:56:26.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/maker_olympus.c 2017-04-16 19:22:54.000000000 +0000 @@ -25,6 +25,7 @@ #include #include +#include #include #include "defs.h" #include "datadefs.h" @@ -231,7 +232,7 @@ } /* make certain we're at the end */ clearerr(inptr); - fseek(inptr,value_offset + count,0); + fseek(inptr,value_offset + count,SEEK_SET); break; case 0x0f00: /* Data */ if(at_offset && (PRINT_ENTRY)) @@ -266,7 +267,7 @@ chpr = newline(1); } /* make certain we're at the end */ - fseek(inptr,value_offset + count,0); + fseek(inptr,value_offset + count,SEEK_SET); break; case 0x2010: /* Private IFD's all */ case 0x2020: @@ -1216,7 +1217,7 @@ } /* make certain we're at the end */ clearerr(inptr); - fseek(inptr,value_offset + count,0); + fseek(inptr,value_offset + count,SEEK_SET); break; case 0x0304: case 0x0503: diff -Nru exifprobe-2.0.1/maker_panasonic.c exifprobe-2.0.1+git20170416.3c2b769/maker_panasonic.c --- exifprobe-2.0.1/maker_panasonic.c 2005-07-24 22:56:27.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/maker_panasonic.c 2017-04-16 19:22:54.000000000 +0000 @@ -21,6 +21,7 @@ #include #include +#include #include #include "defs.h" #include "datadefs.h" @@ -233,6 +234,7 @@ switch(tag) { case 0x0001: tagname = "Quality"; break; + case 0x0002: tagname = "FirmwareVersion"; break; case 0x0003: tagname = "WhiteBalance"; break; case 0x0007: tagname = "FocusMode"; break; case 0x000f: tagname = "SpotMode"; break; @@ -243,6 +245,7 @@ case 0x0023: tagname = "WhiteBalanceAdjust"; break; case 0x0024: tagname = "FlashStrength"; break; case 0x0028: tagname = "ColorMode"; break; + case 0x0029: tagname = "TimeSincePowerOn"; break; case 0x002c: tagname = "Contrast"; break; case 0x002d: tagname = "NoiseReduction"; break; case 0x0e00: tagname = "PrintIM"; break; diff -Nru exifprobe-2.0.1/maker_ricoh.c exifprobe-2.0.1+git20170416.3c2b769/maker_ricoh.c --- exifprobe-2.0.1/maker_ricoh.c 2005-07-24 22:56:27.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/maker_ricoh.c 2017-04-16 19:22:54.000000000 +0000 @@ -12,6 +12,7 @@ #include #include +#include #include "datadefs.h" #include "maker_datadefs.h" #include "summary.h" diff -Nru exifprobe-2.0.1/maker_sanyo.c exifprobe-2.0.1+git20170416.3c2b769/maker_sanyo.c --- exifprobe-2.0.1/maker_sanyo.c 2005-07-24 22:56:27.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/maker_sanyo.c 2017-04-16 19:22:54.000000000 +0000 @@ -23,6 +23,7 @@ #include #include +#include #include #include "defs.h" #include "datadefs.h" @@ -220,7 +221,7 @@ } /* make certain we're at the end */ clearerr(inptr); - fseek(inptr,value_offset + count,0); + fseek(inptr,value_offset + count,SEEK_SET); break; case 0x0e00: /* PrintIM (Epson Print Image matching) */ if(!at_offset && (PRINT_VALUE)) @@ -267,7 +268,7 @@ chpr += printf(" # UNDEFINED"); } /* make certain we're at the end */ - fseek(inptr,value_offset + count,0); + fseek(inptr,value_offset + count,SEEK_SET); break; default: print_generic_offset_makervalue(inptr,byteorder,entry_ptr, diff -Nru exifprobe-2.0.1/maker_sigma.c exifprobe-2.0.1+git20170416.3c2b769/maker_sigma.c --- exifprobe-2.0.1/maker_sigma.c 2005-07-24 22:56:27.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/maker_sigma.c 2017-04-16 19:22:54.000000000 +0000 @@ -18,6 +18,7 @@ #include #include +#include #include #include "defs.h" #include "datadefs.h" diff -Nru exifprobe-2.0.1/maker_sony.c exifprobe-2.0.1+git20170416.3c2b769/maker_sony.c --- exifprobe-2.0.1/maker_sony.c 2005-07-24 22:56:27.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/maker_sony.c 2017-04-16 19:22:54.000000000 +0000 @@ -20,6 +20,7 @@ #include #include +#include #include #include "defs.h" #include "datadefs.h" diff -Nru exifprobe-2.0.1/maker_template exifprobe-2.0.1+git20170416.3c2b769/maker_template --- exifprobe-2.0.1/maker_template 2005-01-27 02:27:32.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/maker_template 2017-04-16 19:22:54.000000000 +0000 @@ -176,7 +176,7 @@ putindent(SUBINDENT); printf("End of %s",nameoftag); /* make certain we're at the end unless 'inptr' bad */ - fseek(inptr,value_offset + entry_ptr->count,0); + fseek(inptr,value_offset + entry_ptr->count,SEEK_SET); break; case 0x0e00: /* PrintIM (Epson Print Image matching) */ case 0x0f00: /* Data */ @@ -197,7 +197,7 @@ indent,SUBINDENT,addrwidth); } /* make certain we're at the end unless 'inptr' bad */ - fseek(inptr,value_offset + entry_ptr->count,0); + fseek(inptr,value_offset + entry_ptr->count,SEEK_SET); break; default: print_generic_offset_makervalue(inptr,byteorder,entry_ptr, @@ -238,7 +238,7 @@ putindent(SUBINDENT); printf("End of %s",nameoftag); /* make certain we're at the end unless 'inptr' bad */ - fseek(inptr,value_offset + entry_ptr->count,0); + fseek(inptr,value_offset + entry_ptr->count,SEEK_SET); break; case 0x0010: /* Data */ print_tag_address(value_offset,indent,prefix,addrwidth); @@ -258,7 +258,7 @@ indent,SUBINDENT,addrwidth); } /* make certain we're at the end */ - fseek(inptr,value_offset + entry_ptr->count,0); + fseek(inptr,value_offset + entry_ptr->count,SEEK_SET); break; default: print_generic_offset_makervalue(inptr,byteorder,entry_ptr, diff -Nru exifprobe-2.0.1/maker_toshiba.c exifprobe-2.0.1+git20170416.3c2b769/maker_toshiba.c --- exifprobe-2.0.1/maker_toshiba.c 2005-07-24 22:56:27.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/maker_toshiba.c 2017-04-16 19:22:54.000000000 +0000 @@ -16,6 +16,7 @@ #include #include +#include #include #include "defs.h" #include "datadefs.h" diff -Nru exifprobe-2.0.1/maker_traveler.c exifprobe-2.0.1+git20170416.3c2b769/maker_traveler.c --- exifprobe-2.0.1/maker_traveler.c 2005-07-24 22:56:27.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/maker_traveler.c 2017-04-16 19:22:54.000000000 +0000 @@ -12,6 +12,7 @@ #include #include +#include #include "datadefs.h" #include "maker_datadefs.h" #include "summary.h" diff -Nru exifprobe-2.0.1/misc.c exifprobe-2.0.1+git20170416.3c2b769/misc.c --- exifprobe-2.0.1/misc.c 2005-07-24 16:01:17.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/misc.c 2017-04-16 19:22:54.000000000 +0000 @@ -86,6 +86,35 @@ } +/* caller must call free() */ +/* return NULL on error / buffer overflow */ +char * +strdup_value(struct ifd_entry *entry, FILE *inptr, + unsigned long fileoffset_base) +{ + char *val = NULL; + if (is_offset(entry)) + { + char *buf = (char *)read_bytes(inptr, + entry->count, + fileoffset_base + + entry->value); + if (buf) { + val = strndup(buf, entry->count); + } + return val; + } + else + { + char *buf = (char *)&(entry->value); + val = (char*)calloc(entry->count + 1, sizeof(char)); + for (int i = 0; i < entry->count; i++) { + val[i] = buf[i]; + } + return val; + } +} + /* Print a summary of all of the images found in the file. This will */ /* include thumbnail images stored by the unpleasant but ubiquitous */ /* JPEFThumbnailFormat method as well as images described by TIFF */ @@ -303,10 +332,19 @@ if(summary_entry->bps[0] && summary_entry->spp) { int i; + int spp = summary_entry->spp; float total_bits,bytes_per_pixel; total_bits = 0; - for(i = 0; i < summary_entry->spp; ++i) + if (spp > MAXSAMPLE) + { + spp = MAXSAMPLE; + if(Debug & 0x4) + { + printf("CLAMPING spp\n"); + } + } + for(i = 0; i < spp; ++i) total_bits += summary_entry->bps[i]; bytes_per_pixel = total_bits / 8.0; if(Debug & 0x4) @@ -787,6 +825,11 @@ chpr += printf(" ORF2 12bps"); entry->imagesubformat = IMGSUBFMT_CFA; } + else if(entry->fileformat == FILEFMT_RW2) + { + chpr += printf(" RW2"); + entry->imagesubformat = IMGSUBFMT_CFA; + } else chpr += printf(" TIFF"); break; diff -Nru exifprobe-2.0.1/misc.h exifprobe-2.0.1+git20170416.3c2b769/misc.h --- exifprobe-2.0.1/misc.h 2005-06-09 02:21:30.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/misc.h 2017-04-16 19:22:54.000000000 +0000 @@ -23,6 +23,8 @@ #define ORF1_MAGIC 0x4f52 /* "RO" 16 bits/sample PMI=1 res=314 */ #define ORF2_MAGIC 0x5352 /* "RS" 12 bits/sample PMI=2 res=72 */ +#define RW2_MAGIC 0x0055 /* "U\0" for Panasonic RAW and RW2 */ + /* Some of these magic numbers are private to this program, used to */ /* id file formats which have no unique magic number. */ #define PROBE_NOMAGIC 0x0000 @@ -35,6 +37,7 @@ #define PROBE_MRWMAGIC 0x004d524d /* "MRM" (ANY byte order) */ #define PROBE_RAFMAGIC 0x4655 /* "FU"JIFILM-CCDRAW (MOT) */ #define PROBE_X3FMAGIC 0x62564f46 /* "FOVb" (INTEL) */ +#define PROBE_RW2MAGIC RW2_MAGIC /* TIFF entry type id */ @@ -51,4 +54,8 @@ #define SRATIONAL 10 #define DOUBLE 12 +char * +strdup_value(struct ifd_entry *entry, FILE *inptr, + unsigned long fileoffset_base); + #endif /* MISC_INCLUDED */ diff -Nru exifprobe-2.0.1/options.c exifprobe-2.0.1+git20170416.3c2b769/options.c --- exifprobe-2.0.1/options.c 2005-07-24 17:18:27.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/options.c 2017-04-16 19:22:54.000000000 +0000 @@ -248,11 +248,15 @@ envopts = getenv("EXIFPROBE_OPTIONS"); if(envopts && *envopts) { + char *argstr = calloc(strlen(envopts) + 3, 1); + strcpy(argstr, "e "); + strcat(argstr, envopts); optind = 0; /* make an argument vector */ - argc = vector(envopts,argv," \t",0,MAXARGV); + argc = vector(argstr, argv, " \t", 0, MAXARGV); (void)process_options(argc,argv); optind = 1; + free(argstr); } } diff -Nru exifprobe-2.0.1/print.c exifprobe-2.0.1+git20170416.3c2b769/print.c --- exifprobe-2.0.1/print.c 2005-07-24 17:16:59.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/print.c 2017-04-16 19:22:54.000000000 +0000 @@ -57,6 +57,10 @@ status = print_tiff_header(ORF2_MAGIC,header->file_marker,section_id); /* no newline */ break; + case RW2_MAGIC: + status = print_tiff_header(RW2_MAGIC,header->file_marker,section_id); + /* no newline */ + break; case TIFF_MAGIC: status = print_tiff_header(TIFF_MAGIC,header->file_marker,section_id); /* no newline */ @@ -109,6 +113,7 @@ case TIFF_MAGIC: name = "TIFF"; break; case ORF1_MAGIC: name = "ORF1"; break; case ORF2_MAGIC: name = "ORF2"; break; + case RW2_MAGIC: name = "RW2"; break; default: break; } @@ -189,6 +194,21 @@ } status = 0; break; + case RW2_MAGIC: + chpr += printf("RW2"); + switch(marker) + { + case TIFF_INTEL: + chpr += printf(":II"); + break; + case TIFF_MOTOROLA: + chpr += printf(":MM"); + break; + default: + break; + } + status = 0; + break; case TIFF_MAGIC: chpr += printf("TIFF"); switch(marker) @@ -811,7 +831,7 @@ } } /* make certain we're at the end */ - fseek(inptr,(long)(value_offset + entry_ptr->count),0); + fseek(inptr,(long)(value_offset + entry_ptr->count),SEEK_SET); break; } if(!at_offset && (PRINT_VALUE)) @@ -904,7 +924,7 @@ /* Read 'count' unsigned bytes starting at 'offset' and print their */ /* values in hex. If there are a lot, just print the first few, an */ /* elipsis to admit that something is left out, then print the count */ -/* and the last value and it's offset. */ +/* and the last value and its offset. */ void print_ubytes(FILE *inptr,unsigned long count,unsigned long offset) @@ -975,7 +995,7 @@ /* Read 'count' signed bytes starting at 'offset' and print their */ /* values in decimale. If there are a lot, just print the first few, */ /* an elipsis to admit that something is left out, then print the */ -/* last value and it's offset. */ +/* last value and its offset. */ void print_sbytes(FILE *inptr,unsigned long count,unsigned long offset) @@ -1468,7 +1488,7 @@ { chpr += printf(" ... "); offset += (unsigned long)(count - j) * 8UL; - fseek(inptr,offset,0); + fseek(inptr,offset,SEEK_SET); num = read_ulong(inptr,byteorder,HERE); if(feof(inptr) || ferror(inptr)) { @@ -1586,7 +1606,7 @@ { chpr += printf(" ... "); offset += (unsigned long)(count - j) * 8UL; - fseek(inptr,offset,0); + fseek(inptr,offset,SEEK_SET); num = (long)read_ulong(inptr,byteorder,HERE); if(feof(inptr) || ferror(inptr)) { @@ -1758,7 +1778,7 @@ remaining = count; nread = 0; - if((offset != HERE) && (fseek(inptr,offset,0) == -1)) + if((offset != HERE) && (fseek(inptr,offset,SEEK_SET) == -1)) { chpr += printf(" seek failed to offset %lu to print ascii",offset); chpr = newline(chpr); @@ -1829,11 +1849,11 @@ { int remaining; int nread; - int ch; + int ch = 0; int chpr = 0; nread = 0; - if((offset != HERE) && (fseek(inptr,offset,0) == -1)) + if((offset != HERE) && (fseek(inptr,offset,SEEK_SET) == -1)) { chpr += printf(" seek failed to offset %lu to print unicode",offset); chpr = newline(chpr); @@ -1952,7 +1972,7 @@ { if(PRINT_SECTION) chpr += printf("length %lu+8: (CC=",count - 8); - if((offset != HERE) && (fseek(inptr,offset,0) == -1)) + if((offset != HERE) && (fseek(inptr,offset,SEEK_SET) == -1)) { chpr += printf("seek failed to offset %lu to process user comment)",offset); chpr = newline(chpr); @@ -1997,7 +2017,7 @@ else { /* check for all spaces */ - if(fseek(inptr,offset + 8,0)) + if(fseek(inptr,offset + 8,SEEK_SET)) { chpr += printf(" re-seek to comment offset %lu failed ",offset + 8); chpr = newline(chpr); @@ -2015,7 +2035,7 @@ chpr += printf("(%d spaces)",i - 8); else { - if(fseek(inptr,offset + i,0)) + if(fseek(inptr,offset + i,SEEK_SET)) { chpr += printf(" re-seek to comment offset %lu failed ",offset + 8); why(stdout); @@ -2108,7 +2128,7 @@ colorstack_index = 0; colorstack[0] = END_COLOR; } - else if(colorstack_index >= COLORSTACKSIZE) + else if(colorstack_index >= (COLORSTACKSIZE - 1)) colorstack_index = 0; printf("\033[%dm",color); @@ -2392,7 +2412,7 @@ if(size < max_to_print) max_to_print = size; - if((offset != HERE) && (fseek(inptr,offset,0) == -1)) + if((offset != HERE) && (fseek(inptr,offset,SEEK_SET) == -1)) { chpr += printf(" seek failed to offset %lu to print hex/ascii dump",offset); chpr = newline(chpr); @@ -2727,10 +2747,10 @@ limit_offset = max_offset; else { - if(fseek(inptr,0L,2) != -1) + if(fseek(inptr,0L,SEEK_END) != -1) { limit_offset = ftell(inptr); - fseek(inptr,0L,current_offset); + fseek(inptr,current_offset,SEEK_SET); } } /* If there's an error on input, or we can't check */ @@ -3197,7 +3217,7 @@ indent,SUBINDENT); } /* make certain we're at the end */ - fseek(inptr,(long)(entry_ptr->value + fileoffset_base + entry_ptr->count),0); + fseek(inptr,(long)(entry_ptr->value + fileoffset_base + entry_ptr->count),SEEK_SET); break; case ASCII: print_ascii(inptr,entry_ptr->count,value_offset); diff -Nru exifprobe-2.0.1/print_maker.c exifprobe-2.0.1+git20170416.3c2b769/print_maker.c --- exifprobe-2.0.1/print_maker.c 2005-07-24 17:27:09.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/print_maker.c 2017-04-16 19:22:54.000000000 +0000 @@ -12,6 +12,7 @@ #include #include +#include #include "defs.h" #include "summary.h" @@ -517,7 +518,7 @@ indent,SUBINDENT); } /* make certain we're at the end */ - fseek(inptr,entry_ptr->value + fileoffset_base + entry_ptr->count,0); + fseek(inptr,entry_ptr->value + fileoffset_base + entry_ptr->count,SEEK_SET); break; case ASCII: print_ascii(inptr,entry_ptr->count,value_offset); diff -Nru exifprobe-2.0.1/private_tags.h exifprobe-2.0.1+git20170416.3c2b769/private_tags.h --- exifprobe-2.0.1/private_tags.h 2005-07-15 17:41:41.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/private_tags.h 2017-04-16 19:22:54.000000000 +0000 @@ -14,7 +14,7 @@ /* Most of these are taken from libtiff/tiff.h, viz. */ /* A few are taken from GeoTIFF */ -#ifndef PRIVATE_TAGS_INDLUDED +#ifndef PRIVATE_TAGS_INCLUDED #define PRIVATE_TAGS_INCLUDED @@ -77,7 +77,24 @@ #define TIFFTAG_CR2_0xc5d8 0xC5D8 /* 50648 */ #define TIFFTAG_CR2_0xc5d9 0xC5D9 /* 50649 */ #define TIFFTAG_CR2_0xc5e0 0xC5E0 /* 50656 */ -#define TIFFTAG_CR2_0xc640 0xC640 /* 50752 */ +#define TIFFTAG_CR2_SLICE 0xC640 /* 50752 */ +#define TIFFTAG_CR2_SRAWTYPE 0xC6C5 /* 50885 */ + +/* Panasonic RAW / RW2 */ +#define TIFFTAG_RW2_PANASONICRAWVERSION 0x0001 /* 00001 */ +#define TIFFTAG_RW2_SENSORWIDTH 0x0002 /* 00002 */ +#define TIFFTAG_RW2_SENSORHEIGHT 0x0003 /* 00003 */ +#define TIFFTAG_RW2_SENSORTOPBORDER 0x0004 /* 00004 */ +#define TIFFTAG_RW2_SENSORLEFTBORDER 0x0005 /* 00005 */ +#define TIFFTAG_RW2_IMAGEHEIGHT 0x0006 /* 00006 */ +#define TIFFTAG_RW2_IMAGEWIDTH 0x0007 /* 00007 */ +#define TIFFTAG_RW2_REDBALANCE 0x0011 /* 00017 */ +#define TIFFTAG_RW2_BLUEBALANCE 0x0012 /* 00018 */ +#define TIFFTAG_RW2_ISO 0x0017 /* 00023 */ +#define TIFFTAG_RW2_WBREDLEVEL 0x0024 /* 00036 */ +#define TIFFTAG_RW2_WBGREENLEVEL 0x0025 /* 00037 */ +#define TIFFTAG_RW2_WBBLUELEVEL 0x0026 /* 00038 */ +#define TIFFTAG_RW2_JPGFROMRAW 0x002E /* 00047 */ #define TIFFTAG_DCSHUESHIFTVALUES 0xFFFF /* 65535 */ #endif diff -Nru exifprobe-2.0.1/process.c exifprobe-2.0.1+git20170416.3c2b769/process.c --- exifprobe-2.0.1/process.c 2005-07-25 22:05:10.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/process.c 2017-04-16 19:22:54.000000000 +0000 @@ -18,6 +18,7 @@ #include #include #include +#include #include #include "defs.h" @@ -248,10 +249,10 @@ limit_offset = max_offset; else { - if(fseek(inptr,0L,2) != -1) + if(fseek(inptr,0L,SEEK_END) != -1) { limit_offset = ftell(inptr); - fseek(inptr,0L,current_offset); + fseek(inptr,current_offset,SEEK_SET); } } /* If there's an error on input, or we can't check */ @@ -415,34 +416,25 @@ case TIFFTAG_Make: if(Make_name == NULL) { - makename = - (char *)read_bytes(inptr, - entry_ptr->count, - fileoffset_base + - entry_ptr->value); - Make_name = strdup(makename); + Make_name = strdup_value(entry_ptr, + inptr, + fileoffset_base); } break; case TIFFTAG_Model: if(Model_name == NULL) { - modelname = - (char *)read_bytes(inptr, - entry_ptr->count, - fileoffset_base + - entry_ptr->value); - Model_name = strdup(modelname); + Model_name = strdup_value(entry_ptr, + inptr, + fileoffset_base); } break; case TIFFTAG_Software: if(Software_name == NULL) { - swname = - (char *)read_bytes(inptr, - entry_ptr->count, - fileoffset_base + - entry_ptr->value); - Software_name = strdup(swname); + Software_name = strdup_value(entry_ptr, + inptr, + fileoffset_base); } break; } @@ -495,7 +487,7 @@ break; case TIFFTAG_CR2_0xc5d8: case TIFFTAG_CR2_0xc5e0: - case TIFFTAG_CR2_0xc640: + case TIFFTAG_CR2_SLICE: /* These tags appear (so far) only in the */ /* weird IFD containing the lossless jpeg */ /* primary. It is possible to check for other */ @@ -549,8 +541,20 @@ } else next_ifd_offset += fileoffset_base; - if((next_ifd_offset < ftell(inptr)) || - ((ifdtype != TIFF_IFD) && (ifdtype != TIFF_SUBIFD))) + + /* Corrupt file will cause infinite loops. So we abort. + * It is possible this can be worked around better. + * See Issue #9 https://github.com/hfiguiere/exifprobe/issues/9 + */ + if(next_ifd_offset < ftell(inptr)) { + printred("\nReading IFD backwards. INVALID FILE. ABORTING.\n"); + exit(1); + } else if (next_ifd_offset > filesize) { + printred("\nReading IFD past EOF. INVALID FILE. ABORTING.\n"); + exit(1); + } + /* We should be able to tolerate these */ + if ((ifdtype != TIFF_IFD) && (ifdtype != TIFF_SUBIFD)) { if(PRINT_SECTION) printred(" INVALID NEXT IFD OFFSET "); @@ -687,12 +691,16 @@ case EXIFTAG_Interoperability: /* This doesn't belong in a TIFF IFD, but */ /* be prepared. */ + /* Also we make sure we are not calling on */ + /* the same ifd offset */ PUSHCOLOR(INTEROP_COLOR); - value_offset = process_tiff_ifd(inptr,byteorder, + if (entry_ptr->value != ifd_offset) { + value_offset = process_tiff_ifd(inptr,byteorder, entry_ptr->value,fileoffset_base, next_ifd_offset,summary_entry, listname,INTEROP_IFD,ifdnum,0, indent); + } value_offset = 0; POPCOLOR(); break; @@ -926,6 +934,8 @@ } if(value_offset == 0L) /* bad entry; try the next one */ clearerr(inptr); + else if(value_offset > filesize) + goto blewit; else if(value_offset > max_value_offset) max_value_offset = value_offset; } @@ -1795,10 +1805,10 @@ limit_offset = max_offset; else { - if(fseek(inptr,0L,2) != -1) + if(fseek(inptr,0L,SEEK_END) != -1) { limit_offset = ftell(inptr); - fseek(inptr,0L,current_offset); + fseek(inptr,current_offset,SEEK_SET); } } /* If there's an error on input, or we can't check */ @@ -2606,7 +2616,7 @@ else { max_offset = 0; - (void)fseek(inptr,start_of_jpeg_data + data_length - 2L,0); + (void)fseek(inptr,start_of_jpeg_data + data_length - 2L,SEEK_SET); (void)jpeg_status(JPEG_NO_EOI); } } @@ -2622,7 +2632,7 @@ /* limit for the search, */ if(Debug & JPEG_EOI_DEBUG) printf("DEBUG: max_eoi=%lu\n",max_eoi); - if(fseek(inptr,0L,2) == 0) + if(fseek(inptr,0L,SEEK_END) == 0) { /* Values to use if a forward scan is */ /* required. */ @@ -2811,6 +2821,7 @@ (void)jpeg_status(JPEG_HAD_ERROR); if(summary_entry) summary_entry->imagesubformat |= IMGSUBFMT_JPEGFAILED; + return 0; } break; case JPEG_COM: @@ -2885,19 +2896,29 @@ unsigned char nf = 0; unsigned char c,h,v,t,p; int i; + int iserror = 0; if(PRINT_SEGMENT) chpr += printf(" length %u",seg_length); p = read_ubyte(inptr,HERE); /* precision */ - if(!ferror(inptr) && !feof(inptr)) + if(!iserror && !ferror(inptr) && !feof(inptr)) img_height = read_ushort(inptr,TIFF_MOTOROLA,HERE); - if(!ferror(inptr) && !feof(inptr)) + if(!iserror && !ferror(inptr) && !feof(inptr)) img_width = read_ushort(inptr,TIFF_MOTOROLA,HERE); - if(!ferror(inptr) && !feof(inptr)) + if(!iserror && !ferror(inptr) && !feof(inptr)) img_pixels = img_height * img_width; - if(!ferror(inptr) && !feof(inptr)) + if(!iserror && !ferror(inptr) && !feof(inptr)) + { nf = read_ubyte(inptr,HERE); /* components */ - if(!ferror(inptr) && !feof(inptr)) + if (nf > MAXSAMPLE) + { + // See https://github.com/hfiguiere/exifprobe/issues/2 + // we shouldn't need to clamp nf value. + nf = MAXSAMPLE; + iserror = 1; + } + } + if(!iserror && !ferror(inptr) && !feof(inptr)) { max_offset = ftell(inptr); if(PRINT_SEGMENT) @@ -2910,7 +2931,7 @@ summary_entry->bps[i] = p; } } - if(ferror(inptr) || feof(inptr)) + if(iserror || ferror(inptr) || feof(inptr)) { tag = 0; clearerr(inptr); @@ -3308,11 +3329,11 @@ unsigned long tagloc; int chpr = 0; - if(inptr && (fseek(inptr,start_of_data,0) != -1)) + if(inptr && (fseek(inptr,start_of_data,SEEK_SET) != -1)) { if(Debug & JPEG_EOI_DEBUG) printf("DEBUG: start scan at %lu\n",start_of_data); - while(((highbyte = fgetc(inptr)) != EOF) && (ftell(inptr) < end_of_section)) + while(((highbyte = fgetc(inptr)) != EOF) && (highbyte != EOF) && (ftell(inptr) < end_of_section)) { if(highbyte != JPEG_HIBYTE) continue; @@ -3903,8 +3924,15 @@ if(PRINT_SECTION) { extraindent(indent + ADDRWIDTH); - chpr += printf(" INVALID MAGIC %lu (%s) where TIFF header should be", - header->probe_magic,tagname(header->probe_magic)); + if(header) + { + chpr += printf(" INVALID MAGIC %lu (%s) where TIFF header should be", + header->probe_magic,tagname(header->probe_magic)); + } + else + { + chpr += printf(" INVALID HEADER for TIFF"); + } #define PRINT_A_BIT 48 if(app_length > PRINT_A_BIT) dumplength = PRINT_A_BIT; @@ -4088,8 +4116,15 @@ if(PRINT_SECTION) { extraindent(indent + ADDRWIDTH); - chpr += printf(" INVALID MAGIC %lu (%s) where TIFF header should be", - header->probe_magic,tagname(header->probe_magic)); + if(header) + { + chpr += printf(" INVALID MAGIC %lu (%s) where TIFF header should be", + header->probe_magic,tagname(header->probe_magic)); + } + else + { + chpr += printf(" INVALID HEADER for TIFF"); + } #define PRINT_A_BIT 48 if(app_length > PRINT_A_BIT) dumplength = PRINT_A_BIT; @@ -4242,7 +4277,7 @@ chpr += printf("",name); chpr = newline(chpr); } - fseek(inptr,appn_offset + app_length,0); + fseek(inptr,appn_offset + app_length,SEEK_SET); } setcharsprinted(chpr); return(appn_offset + app_length + 2); @@ -4326,7 +4361,7 @@ nextch = putword(inptr,nextch,end_offset,indent); chpr = newline(chpr); offset = ftell(inptr); - while(nextch && (offset < end_offset)) + while(nextch && (nextch != EOF) && (offset < end_offset)) { nextch = putword(inptr,nextch,end_offset,indent); if(nextch) @@ -4336,6 +4371,10 @@ while(offset < end_offset) { nextch = skip_to_bracket(inptr,end_offset); + if(nextch == EOF) + { + break; + } size = ftell(inptr) - offset; if(nextch == '[') --size; @@ -4350,7 +4389,7 @@ SMALLINDENT); chpr = newline(1); nextch = fgetc(inptr); - if(ftell(inptr) >= end_offset) + if((nextch == EOF) || (ftell(inptr) >= end_offset)) break; } else @@ -4384,7 +4423,8 @@ int skip_past_newline(FILE *inptr,unsigned long max_offset) { - while(((unsigned long)ftell(inptr) < max_offset) && (fgetc(inptr) != '\n')) + int ch; + while(((unsigned long)ftell(inptr) < max_offset) && ((ch = fgetc(inptr)) != '\n') && ch != EOF) continue; return(fgetc(inptr)); } @@ -4397,7 +4437,7 @@ { int ch = EOF; - while(((unsigned long)ftell(inptr) < max_offset) && ((ch = fgetc(inptr)) != '[')) + while(((unsigned long)ftell(inptr) < max_offset) && ((ch = fgetc(inptr)) != '[') && ch != EOF) continue; if(ftell(inptr) >= max_offset) ch = 0; diff -Nru exifprobe-2.0.1/raf.c exifprobe-2.0.1+git20170416.3c2b769/raf.c --- exifprobe-2.0.1/raf.c 2005-07-24 20:33:55.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/raf.c 2017-04-16 19:22:54.000000000 +0000 @@ -49,12 +49,12 @@ if(Print_options & section_id) { - /* ###%%% for now, the first 48 bytes are "header" */ + /* ###%%% for now, the first 60 bytes are "header" */ if(fileheader && (fileheader->probe_magic == PROBE_RAFMAGIC)) { print_ascii(inptr,28,0); chpr += printf(" Model = "); - print_ascii(inptr,16,28); + print_ascii(inptr,32,28); status = 0; } else @@ -110,12 +110,7 @@ print_tag_address(SECTION,offset,indent,"@"); chpr += printf(""); chpr = newline(chpr); - print_tag_address(ENTRY,offset,indent + SMALLINDENT,"@"); - if((PRINT_VALUE)) - print_ubytes(inptr,16,offset); - chpr = newline(chpr); } - offset += 16; /* Some sort of ID or version? */ print_tag_address(ENTRY,offset,indent + SMALLINDENT,"@"); @@ -123,22 +118,22 @@ { if((PRINT_LONGNAMES)) chpr += printf("%s.",parent_name); - chpr += printf("%-*.*s",TAGWIDTH,TAGWIDTH,"unknown1"); + chpr += printf("%-*.*s",TAGWIDTH,TAGWIDTH,"HeaderVersion"); } if((PRINT_VALUE)) { chpr += printf(" = "); - print_ascii(inptr,4,60); + print_ascii(inptr,4,offset); } chpr = newline(chpr); offset += 4; - /* Another short section of zeros. Why again? */ + /* A 20 bytes section of zeros. Unknown */ if((PRINT_SECTION)) { print_tag_address(ENTRY,offset,indent + SMALLINDENT,"@"); if((PRINT_VALUE)) - print_ubytes(inptr,16,offset); + print_ubytes(inptr,20,offset); chpr = newline(chpr); } diff -Nru exifprobe-2.0.1/readfile.c exifprobe-2.0.1+git20170416.3c2b769/readfile.c --- exifprobe-2.0.1/readfile.c 2005-07-24 18:15:28.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/readfile.c 2017-04-16 19:22:54.000000000 +0000 @@ -23,6 +23,7 @@ #include +#include #include #include #include @@ -99,6 +100,11 @@ fileheader.probe_magic = ORF2_MAGIC; fileheader.file_marker = marker; } + else if(magic == RW2_MAGIC) + { + fileheader.probe_magic = RW2_MAGIC; + fileheader.file_marker = marker; + } else if((ciffheader = read_ciffheader(inptr,marker,offset))) { fileheader.file_marker = ciffheader->byteorder; @@ -129,8 +135,8 @@ if(length == 12) { type = read_bytes(inptr,4,HERE); - if((strncmp((char *)type,"jP\040\040 ",4) == 0) || - (strncmp((char *)type,"jP\032\032 ",4) == 0)) + if(type && ((strncmp((char *)type,"jP\040\040 ",4) == 0) || + (strncmp((char *)type,"jP\032\032 ",4) == 0))) { umagic = read_ulong(inptr,TIFF_MOTOROLA,HERE); if(umagic == 0x0d0a870a) @@ -274,7 +280,7 @@ { clearerr(inptr); curoffset = ftell(inptr); - if((offset != HERE) && (fseek(inptr,offset,0) == -1)) + if((offset != HERE) && (fseek(inptr,offset,SEEK_SET) == -1)) { printred(" SEEK FAILED to read unsigned short at offset "); printf("%lu",offset); @@ -322,7 +328,7 @@ { clearerr(inptr); curoffset = ftell(inptr); - if((offset != HERE) && (fseek(inptr,offset,0) == -1)) + if((offset != HERE) && (fseek(inptr,offset,SEEK_SET) == -1)) { printred(" SEEK FAILED to read unsigned byte at offset "); chpr += printf("%lu",offset); @@ -373,7 +379,7 @@ { clearerr(inptr); curoffset = ftell(inptr); - if((offset != HERE) && (fseek(inptr,offset,0) == -1)) + if((offset != HERE) && (fseek(inptr,offset,SEEK_SET) == -1)) { printred(" SEEK FAILED to read unsigned 32bit integer at offset "); printf("%lu",offset); @@ -433,7 +439,7 @@ { clearerr(inptr); curoffset = ftell(inptr); - if((offset != HERE) && (fseek(inptr,offset,0) == -1)) + if((offset != HERE) && (fseek(inptr,offset,SEEK_SET) == -1)) chpr += printf(" seek failed to offset %lu to read unsigned long\n", offset); else if(fread(rbuf,1,sizeof(long long),inptr) == sizeof(long long)) @@ -494,7 +500,7 @@ { clearerr(inptr); curoffset = ftell(inptr); - if((offset != HERE) && (fseek(inptr,offset,0) == -1)) + if((offset != HERE) && (fseek(inptr,offset,SEEK_SET) == -1)) chpr += printf(" seek failed to offset %lu to read unsigned long\n", offset); else if(fread(rbuf,1,sizeof(double),inptr) == sizeof(double)) @@ -520,7 +526,7 @@ { static unsigned char rbuf[MAXBUFLEN]; unsigned long curoffset; - unsigned char *value = (unsigned char *)NULLSTRING; + unsigned char *value = NULL; int chpr = 0; memset(rbuf,0,MAXBUFLEN); @@ -538,7 +544,7 @@ { clearerr(inptr); curoffset = ftell(inptr); - if((offset != HERE) && (fseek(inptr,offset,0) == -1)) + if((offset != HERE) && (fseek(inptr,offset,SEEK_SET) == -1)) { printred(" SEEK FAILED to read unsigned bytes at offset "); chpr += printf("%lu",offset); @@ -730,7 +736,7 @@ { clearerr(inptr); curoffset = ftell(inptr); - if((offset != HERE) && (fseek(inptr,offset,0) == -1)) + if((offset != HERE) && (fseek(inptr,offset,SEEK_SET) == -1)) { printred(" SEEK FAILED to read ascii string at offset "); chpr += printf("%lu",offset); @@ -804,10 +810,10 @@ clearerr(inptr); /* move back here after getting the size */ current_offset = ftell(inptr); - if(fseek(inptr,0L,2) == 0) + if(fseek(inptr,0L,SEEK_END) == 0) { size = ftell(inptr); - if(fseek(inptr,current_offset,0) != 0) + if(fseek(inptr,current_offset,SEEK_SET) != 0) clearerr(inptr); /* silently */ } else diff -Nru exifprobe-2.0.1/README.md exifprobe-2.0.1+git20170416.3c2b769/README.md --- exifprobe-2.0.1/README.md 1970-01-01 00:00:00.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/README.md 2017-04-16 19:22:54.000000000 +0000 @@ -0,0 +1,18 @@ + +This is a “fork” of exifprobe, a tool to probe Exif and other digital +camera RAW files. + +Based on the 2.0.1 tarball as found in Debian. + +Current maintainer: Hubert Figuière + +Original maintainer: Duane H. Hesser + +See file LICENSE.EXIFPROBE for the license +(basically a 3 clause BSD). + +SECURITY NOTE +============= + +This software hasn't been reviewed for security. Don't run it as +root. Beware running it on untrusted source data. \ No newline at end of file diff -Nru exifprobe-2.0.1/summary.h exifprobe-2.0.1+git20170416.3c2b769/summary.h --- exifprobe-2.0.1/summary.h 2005-07-24 21:15:04.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/summary.h 2017-04-16 19:22:54.000000000 +0000 @@ -19,6 +19,7 @@ #define FILEFMT_TIFF PROBE_TIFFMAGIC #define FILEFMT_ORF1 PROBE_ORF1MAGIC #define FILEFMT_ORF2 PROBE_ORF2MAGIC +#define FILEFMT_RW2 PROBE_RW2MAGIC #define FILEFMT_JPEG PROBE_JPEGMAGIC #define FILEFMT_JP2 PROBE_JP2MAGIC #define FILEFMT_CIFF PROBE_CIFFMAGIC diff -Nru exifprobe-2.0.1/tagnames.c exifprobe-2.0.1+git20170416.3c2b769/tagnames.c --- exifprobe-2.0.1/tagnames.c 2005-07-24 19:40:09.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/tagnames.c 2017-04-16 19:22:54.000000000 +0000 @@ -21,6 +21,7 @@ #include "tags.h" #include "extern.h" #include "ciff.h" +#include "dngtags.h" /* This function attempts to print a "canonical" name for every tag */ /* in the TIFF6, TIFF_EP, EXIF, DNG, and JPEG (10918-1) */ @@ -41,6 +42,21 @@ switch(tag) { +/* 1 */ case 0x01: tagname = "PanasonicRawVersion"; break; /* RW2 */ +/* 2 */ case 0x02: tagname = "SensorWidth"; break; /* RW2 */ +/* 3 */ case 0x03: tagname = "SensorHeight"; break; /* RW2 */ +/* 4 */ case 0x04: tagname = "SensorTopBorder"; break; /* RW2 */ +/* 5 */ case 0x05: tagname = "SensorLeftBorder"; break; /* RW2 */ +/* 6 */ case 0x06: tagname = "ImageHeight"; break; /* RW2 */ +/* 7 */ case 0x07: tagname = "ImageWidth"; break; /* RW2 */ +/* 17 */ case 0x11: tagname = "RedBalance"; break; /* RW2 */ +/* 18 */ case 0x12: tagname = "BlueBalance"; break; /* RW2 */ +/* 23 */ case 0x17: tagname = "ISO"; break; /* RW2 */ +/* 36 */ case 0x24: tagname = "WBRedLevel"; break; /* RW2 */ +/* 37 */ case 0x25: tagname = "WBGreenLevel"; break; /* RW2 */ +/* 38 */ case 0x26: tagname = "WBBlueLevel"; break; /* RW2 */ +/* 47 */ case 0x2E: tagname = "JpgFromRaw"; break; /* RW2 */ + /* 254 */ case 0xFE: tagname = "NewSubFileType"; break; /* TIFF6, TIFFEP */ /* 255 */ case 0xFF: tagname = "SubFileType"; break; /* TIFF6 */ /* 256 */ case 0x100: tagname = "ImageWidth"; break; /* TIFF6 EXIF TIFFEP */ @@ -218,6 +234,7 @@ /* 34855 */ case 0x8827: tagname = "ISOSpeedRatings"; break; /* EXIF TIFFEP */ /* 34856 */ case 0x8828: tagname = "OECF"; break; /* EXIF TIFFEP */ /* 34857 */ case 0x8829: tagname = "Interlace"; break; /* TIFFEP */ +/* 34864 */ case 0x8830: tagname = "SensitivityType"; break; /* Exiv2 */ /* 34858 */ case 0x882A: tagname = "TimeZoneOffset"; break; /* TIFFEP */ /* 34859 */ case 0x882B: tagname = "SelfTimerMode"; break; /* TIFFEP */ /* 36864 */ case 0x9000: tagname = "Version"; break; /* EXIF */ @@ -284,6 +301,12 @@ /* 41995 */ case 0xA40B: tagname = "DeviceSettingDescription"; break; /* EXIF */ /* 41996 */ case 0xA40C: tagname = "SubjectDistanceRange"; break; /* EXIF */ /* 42016 */ case 0xA420: tagname = "ImageUniqueId"; break; /* EXIF */ + +/* 42034 */ case 0xA432: tagname = "LensSpecification"; break; /* Fuji? Exiv2 */ +/* 42035 */ case 0xA433: tagname = "LensMake"; break; /* Fuji? Exiv2 */ +/* 42036 */ case 0xA434: tagname = "LensModel"; break; /* Fuji? Exiv2 */ +/* 42037 */ case 0xA435: tagname = "LensSerial"; break; /* Fuji? Exiv2 */ + /* 42240 */ case 0xA500: tagname = "Gamma"; break; /* EXIF 221 */ /* 50003 */ case 0xC353: tagname = "META_Model"; break; /* Kodak APP3 Meta */ @@ -293,7 +316,7 @@ /* 50648 */ case 0xC5D8: tagname = "TAG_CR2c5d8"; break; /* Canon CR2 */ /* 50649 */ case 0xC5D9: tagname = "TAG_CR2c5d9"; break; /* Canon CR2 */ /* 50656 */ case 0xC5E0: tagname = "TAG_CR2c5e0"; break; /* Canon CR2 */ -/* 50752 */ case 0xC640: tagname = "TAG_CR2c640"; break; /* Canon CR2 */ +/* 50752 */ case 0xC640: tagname = "CR2Slice"; break; /* Canon CR2 */ /* 50706 */ case 0xC612: tagname = "DNGVersion"; break; /* DNG */ /* 50707 */ case 0xC613: tagname = "DNGBackwardVersion"; break; /* DNG */ @@ -345,6 +368,61 @@ /* 50833 */ case 0xC691: tagname = "CurrentICCProfile"; break; /* DNG */ /* 50834 */ case 0xC692: tagname = "CurrentPreProfileMatrix"; break; /* DNG */ +/* 50879 */ case 0xC6BF: tagname = "ColorimetricReference"; break; /* DNG 1.2 */ + +/* 50931 */ case 0xC6F3: tagname = "CameraCalibrationSignature"; break; /* DNG 1.2 */ +/* 50932 */ case 0xC6F4: tagname = "ProfileCalibrationSignature"; break;/* DNG 1.2 */ +/* 50933 */ case 0xC6F5: tagname = "ExtraCameraProfiles"; break; /* DNG 1.2 */ +/* 50934 */ case 0xC6F6: tagname = "AsShotProfileName"; break; /* DNG 1.2 */ +/* 50935 */ case 0xC6F7: tagname = "NoiseReductionApplied"; break; /* DNG 1.2 */ +/* 50936 */ case 0xC6F8: tagname = "ProfileName"; break; /* DNG 1.2 */ +/* 50937 */ case 0xC6F9: tagname = "ProfileHueSatMapDims"; break; /* DNG 1.2 */ +/* 50938 */ case 0xC6FA: tagname = "ProfileHueSatMapData1"; break; /* DNG 1.2 */ +/* 50939 */ case 0xC6FB: tagname = "ProfileHueSatMapData2"; break; /* DNG 1.2 */ +/* 50940 */ case 0xC6FC: tagname = "ProfileToneCurve"; break; /* DNG 1.2 */ +/* 50941 */ case 0xC6FD: tagname = "ProfileEmbedPolicy"; break; /* DNG 1.2 */ +/* 50942 */ case 0xC6FE: tagname = "ProfileCopyright"; break; /* DNG 1.2 */ + +/* 50964 */ case 0xC714: tagname = "ForwardMatrix1"; break; /* DNG 1.2 */ +/* 50965 */ case 0xC715: tagname = "ForwardMatrix2"; break; /* DNG 1.2 */ +/* 50966 */ case 0xC716: tagname = "PreviewApplicationName"; break; /* DNG 1.2 */ +/* 50967 */ case 0xC717: tagname = "PreviewApplicationVersion"; break; /* DNG 1.2 */ +/* 50968 */ case 0xC718: tagname = "PreviewSettingsName"; break; /* DNG 1.2 */ +/* 50969 */ case 0xC719: tagname = "PreviewSettingsDigest"; break; /* DNG 1.2 */ +/* 50970 */ case 0xC71A: tagname = "PreviewColorSpace"; break; /* DNG 1.2 */ +/* 50971 */ case 0xC71B: tagname = "PreviewDateTime"; break; /* DNG 1.2 */ +/* 50972 */ case 0xC71C: tagname = "RawImageDigest"; break; /* DNG 1.2 */ +/* 50973 */ case 0xC71D: tagname = "OriginalRawFileDigest"; break; /* DNG 1.2 */ +/* 50974 */ case 0xC71E: tagname = "SubTileBlockSize"; break; /* DNG 1.2 */ +/* 50975 */ case 0xC71F: tagname = "RowInterleaveFactor"; break; /* DNG 1.2 */ + +/* 50981 */ case 0xC725: tagname = "ProfileLookTableDims"; break; /* DNG 1.2 */ +/* 50982 */ case 0xC726: tagname = "ProfileLookTableData"; break; /* DNG 1.2 */ + +/* 51008 */ case 0xC740: tagname = "OpcodeList1"; break; /* DNG 1.3 */ +/* 51009 */ case 0xC741: tagname = "OpcodeList2"; break; /* DNG 1.3 */ + +/* 51022 */ case 0xC74E: tagname = "OpcodeList3"; break; /* DNG 1.3 */ + +/* 51041 */ case 0xC761: tagname = "NoiseProfile"; break; /* DNG 1.3 */ + +/* 51043 */ case DNGTAG_TimeCodes: tagname = "TimeCodes"; break; /* Cinama DNG */ +/* 51044 */ case DNGTAG_FrameRate: tagname = "FrameRate"; break; /* Cinema DNG */ +/* 51058 */ case DNGTAG_TStop: tagname = "TStop"; break; /* Cinema DNG */ +/* 51081 */ case DNGTAG_ReelName: tagname = "ReelName"; break; /* Cinema DNG */ +/* 51105 */ case DNGTAG_CameraLabel: tagname = "CameraLabel"; break; /* Cinema DNG */ + +/* 51089 */ case DNGTAG_OriginalDefaultFinalSize: tagname = "OriginalDefaultFinalSize"; break; /* DNG 1.4.0 */ +/* 51090 */ case DNGTAG_OriginalBestQualityFinalSize: tagname = "OriginalBestQualityFinalSize"; break; /* DNG 1.4.0 */ +/* 51091 */ case DNGTAG_OriginalDefaultCropSize: tagname = "OriginalDefaultCropSize"; break; /* DNG 1.4.0 */ +/* 51107 */ case DNGTAG_ProfileHueSatMapEncoding: tagname = "ProfileHueSatMapEncoding"; break; /* DNG 1.4.0 */ +/* 51108 */ case DNGTAG_ProfileLookTableEncoding: tagname = "ProfileLookTableEncoding"; break; /* DNG 1.4.0 */ +/* 51109 */ case DNGTAG_BaselineExposureOffset: tagname = "BaselineExposureOffset"; break; /* DNG 1.4.0 */ +/* 51110 */ case DNGTAG_DefaultBlackRender: tagname = "DefaultBlackRender"; break; /* DNG 1.4.0 */ +/* 51111 */ case DNGTAG_NewRawImageDigest: tagname = "NewRawImageDigest"; break; /* DNG 1.4.0 */ +/* 51112 */ case DNGTAG_RawToPreviewGain: tagname = "RawToPreviewGain"; break; /* DNG 1.4.0 */ +/* 51125 */ case DNGTAG_DefaultUserCrop: tagname = "DefaultUserCrop"; break; /* DNG 1.4.0 */ + /* %%%%% */ case 0xffc0: tagname = "JPEG_SOF_0"; break; /* JPEG */ /* EXIF */ /* %%%%% */ case 0xffc1: tagname = "JPEG_SOF_1"; break; /* JPEG */ diff -Nru exifprobe-2.0.1/.travis.yml exifprobe-2.0.1+git20170416.3c2b769/.travis.yml --- exifprobe-2.0.1/.travis.yml 1970-01-01 00:00:00.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/.travis.yml 2017-04-16 19:22:54.000000000 +0000 @@ -0,0 +1,38 @@ +language: c + +os: + - linux + - osx + +matrix: + include: + - os: linux + dist: trusty + - os: osx + osx_image: xcode7.2 + - os: osx + osx_image: xcode8.1 + - compiler: gcc + env: COMPILER=gcc + - compiler: gcc + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - gcc-5 + env: COMPILER=gcc-5 + - compiler: gcc + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - gcc-6 + env: COMPILER=gcc-6 +before_install: + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi + #- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install ; fi + +script: + - make diff -Nru exifprobe-2.0.1/version.h exifprobe-2.0.1+git20170416.3c2b769/version.h --- exifprobe-2.0.1/version.h 2005-07-24 23:07:57.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/version.h 2017-04-16 19:22:54.000000000 +0000 @@ -1,6 +1,6 @@ /* Version information for exifprobe */ /* @(#) $Id: version.h,v 1.17 2005/07/24 23:07:57 alex Exp $ */ -char *Copyright = "Copyright (C) 2005 Duane H. Hesser"; -char *Program_version = "2.0.1"; +char *Copyright = "Copyright (C) 2005 Duane H. Hesser, (C) 2011-2015 Hubert Figuiere"; +char *Program_version = "2.1.0"; #define PATCHLEVEL 0 diff -Nru exifprobe-2.0.1/win/byteorder.h exifprobe-2.0.1+git20170416.3c2b769/win/byteorder.h --- exifprobe-2.0.1/win/byteorder.h 1970-01-01 00:00:00.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/win/byteorder.h 2017-04-16 19:22:54.000000000 +0000 @@ -0,0 +1 @@ +#define NATIVE_BYTEORDER_LITTLE_ENDIAN diff -Nru exifprobe-2.0.1/win/comptime.c exifprobe-2.0.1+git20170416.3c2b769/win/comptime.c --- exifprobe-2.0.1/win/comptime.c 1970-01-01 00:00:00.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/win/comptime.c 2017-04-16 19:22:54.000000000 +0000 @@ -0,0 +1 @@ +char *Comptime = __DATE__ " " __TIME__; diff -Nru exifprobe-2.0.1/win/exifprobe.sln exifprobe-2.0.1+git20170416.3c2b769/win/exifprobe.sln --- exifprobe-2.0.1/win/exifprobe.sln 1970-01-01 00:00:00.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/win/exifprobe.sln 2017-04-16 19:22:54.000000000 +0000 @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "exifprobe", "exifprobe.vcxproj", "{6489E0DA-98B2-4B8B-BDE5-68D3CE5E0CD3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6489E0DA-98B2-4B8B-BDE5-68D3CE5E0CD3}.Debug|Win32.ActiveCfg = Debug|Win32 + {6489E0DA-98B2-4B8B-BDE5-68D3CE5E0CD3}.Debug|Win32.Build.0 = Debug|Win32 + {6489E0DA-98B2-4B8B-BDE5-68D3CE5E0CD3}.Release|Win32.ActiveCfg = Release|Win32 + {6489E0DA-98B2-4B8B-BDE5-68D3CE5E0CD3}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff -Nru exifprobe-2.0.1/win/exifprobe.vcxproj exifprobe-2.0.1+git20170416.3c2b769/win/exifprobe.vcxproj --- exifprobe-2.0.1/win/exifprobe.vcxproj 1970-01-01 00:00:00.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/win/exifprobe.vcxproj 2017-04-16 19:22:54.000000000 +0000 @@ -0,0 +1,134 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {6489E0DA-98B2-4B8B-BDE5-68D3CE5E0CD3} + Win32Proj + exifprobe + + + + Application + true + Unicode + + + Application + false + true + Unicode + + + + + + + + + + + + + true + + + false + + + + + + Level3 + Disabled + WIN32;u_int32_t=uint32_t;strncasecmp=_strnicmp;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + . + + + Console + true + + + + + Level3 + + + MaxSpeed + true + true + WIN32;u_int32_t=uint32_t;strncasecmp=_strnicmp;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + . + + + Console + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -Nru exifprobe-2.0.1/win/exifprobe.vcxproj.filters exifprobe-2.0.1+git20170416.3c2b769/win/exifprobe.vcxproj.filters --- exifprobe-2.0.1/win/exifprobe.vcxproj.filters 1970-01-01 00:00:00.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/win/exifprobe.vcxproj.filters 2017-04-16 19:22:54.000000000 +0000 @@ -0,0 +1,168 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff -Nru exifprobe-2.0.1/win/exifprobe.vcxproj.user exifprobe-2.0.1+git20170416.3c2b769/win/exifprobe.vcxproj.user --- exifprobe-2.0.1/win/exifprobe.vcxproj.user 1970-01-01 00:00:00.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/win/exifprobe.vcxproj.user 2017-04-16 19:22:54.000000000 +0000 @@ -0,0 +1,8 @@ + + + + + + WindowsLocalDebugger + + \ No newline at end of file diff -Nru exifprobe-2.0.1/win/getopt.c exifprobe-2.0.1+git20170416.3c2b769/win/getopt.c --- exifprobe-2.0.1/win/getopt.c 1970-01-01 00:00:00.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/win/getopt.c 2017-04-16 19:22:54.000000000 +0000 @@ -0,0 +1,137 @@ +/* $NetBSD: getopt.c,v 1.26 2003/08/07 16:43:40 agc Exp $ */ + +/* + * Copyright (c) 1987, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95"; +#endif /* LIBC_SCCS and not lint */ +#include +#include +#include +#include "getopt.h" + +int opterr = 1, /* if error message should be printed */ + optind = 1, /* index into parent argv vector */ + optopt, /* character checked for validity */ + optreset; /* reset getopt */ +char *optarg; /* argument associated with option */ + +#define BADCH (int)'?' +#define BADARG (int)':' +#define EMSG "" + +/* + * Get program name in Windows + */ +const char * _getprogname(void); + +/* + * getopt -- + * Parse argc/argv argument vector. + */ +int +getopt(int nargc, char * const nargv[], const char *ostr) +{ + static char *place = EMSG; /* option letter processing */ + char *oli; /* option letter list index */ + + if (optreset || *place == 0) { /* update scanning pointer */ + optreset = 0; + place = nargv[optind]; + if (optind >= nargc || *place++ != '-') { + /* Argument is absent or is not an option */ + place = EMSG; + return (-1); + } + optopt = *place++; + if (optopt == '-' && *place == 0) { + /* "--" => end of options */ + ++optind; + place = EMSG; + return (-1); + } + if (optopt == 0) { + /* Solitary '-', treat as a '-' option + if the program (eg su) is looking for it. */ + place = EMSG; + if (strchr(ostr, '-') == NULL) + return (-1); + optopt = '-'; + } + } else + optopt = *place++; + + /* See if option letter is one the caller wanted... */ + if (optopt == ':' || (oli = strchr(ostr, optopt)) == NULL) { + if (*place == 0) + ++optind; + if (opterr && *ostr != ':') + (void)fprintf(stderr, + "%s: illegal option -- %c\n", _getprogname(), + optopt); + return (BADCH); + } + + /* Does this option need an argument? */ + if (oli[1] != ':') { + /* don't need argument */ + optarg = NULL; + if (*place == 0) + ++optind; + } else { + /* Option-argument is either the rest of this argument or the + entire next argument. */ + if (*place) + optarg = place; + else if (nargc > ++optind) + optarg = nargv[optind]; + else { + /* option-argument absent */ + place = EMSG; + if (*ostr == ':') + return (BADARG); + if (opterr) + (void)fprintf(stderr, + "%s: option requires an argument -- %c\n", + _getprogname(), optopt); + return (BADCH); + } + place = EMSG; + ++optind; + } + return (optopt); /* return option letter */ +} + +const char * _getprogname() { + char *pgmptr = NULL; + _get_pgmptr(&pgmptr); + return strrchr(pgmptr,'\\')+1; +} + diff -Nru exifprobe-2.0.1/win/getopt.h exifprobe-2.0.1+git20170416.3c2b769/win/getopt.h --- exifprobe-2.0.1/win/getopt.h 1970-01-01 00:00:00.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/win/getopt.h 2017-04-16 19:22:54.000000000 +0000 @@ -0,0 +1,26 @@ +#ifndef GETOPT_H +#define GETOPT_H + +#ifndef _WIN32 + +#include + +#else /* _WIN32 */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +extern char *optarg; +extern int optind, opterr, optopt, optreset; + +int getopt(int nargc, char * const nargv[], const char *ostr); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* !_WIN32 */ + +#endif /* !GETOPT_H */ + diff -Nru exifprobe-2.0.1/win/README_WIN.txt exifprobe-2.0.1+git20170416.3c2b769/win/README_WIN.txt --- exifprobe-2.0.1/win/README_WIN.txt 1970-01-01 00:00:00.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/win/README_WIN.txt 2017-04-16 19:22:54.000000000 +0000 @@ -0,0 +1,52 @@ +How to build exifprobe with Microsoft Windows Visual Studio 2010 +================================================================ + +The "win" directory contains a Visual Studio 2010 solution which builds +exifprobe under the Windows OS. + +The Visual Studio solution has successfully been used to compile the original +exifprobe 2.0.1 sources developed 2002-2005 by Duane H. Hesser (who died in +2012) as well as the forked and improved version 2.1.0 from Hubert Figuiere +(this code, available at https://github.com/hfiguiere/exifprobe). + +The original 2.0.1 source code archive can be found at +http://archive.ubuntu.com/ubuntu/pool/universe/e/exifprobe/exifprobe_2.0.1.orig.tar.gz + +* The Visual Studio project file exifprobe.vcxproj contains the following + custom settings: + - Additional Include Directories: . + - Preprocessor: u_int32_t=uint32_t strncasecmp=_strnicmp + +* The following files have been added in the "win" directory. They are only used + when exifprobe is build under Windows. + - a file byteorder.h with defines NATIVE_BYTEORDER_LITTLE_ENDIAN + - a file comptime.h + - an empty file as a replacement for unistd.h + - a replacement for getopt.h and getopt.c (with BSD license) from + http://www.rohitab.com/discuss/topic/39420-a-proper-port-of-getopt/ + - a file snprintf.c which wrapps the Windows _snprintf() function to work around its non + standard negative return value, see http://stackoverflow.com/a/13067917/321013 + +* The following modifications had to be applied to the original 2.0.1 source code + + diff exifprobe-2.0.1.orig/main.c exifprobe-2.0.1/main.c + 86c86 + < inptr = fopen(file,"r"); + --- + > inptr = fopen(file,"rb"); + + diff exifprobe-2.0.1.orig/process.c exifprobe-2.0.1/process.c + 254c254,255 + < fseek(inptr,0L,current_offset); + --- + > fseek(inptr,current_offset,0); + + diff exifprobe-2.0.1.orig/readfile.c exifprobe-2.0.1/readfile.c + 25a26 + > #include + +* To generate the Windows executable open and build the solution exifprobe.sln + in Visual Studio 2010 or later. + A number of warnigns will be displayed (mixing unsigned and signed integers, + use of deprecated posix functions). + Finally the generated exifprobe.exe file can be found in the Debug directory. diff -Nru exifprobe-2.0.1/win/snprintf.c exifprobe-2.0.1+git20170416.3c2b769/win/snprintf.c --- exifprobe-2.0.1/win/snprintf.c 1970-01-01 00:00:00.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/win/snprintf.c 2017-04-16 19:22:54.000000000 +0000 @@ -0,0 +1,16 @@ +#include +#include + +int snprintf(char *buffer, size_t count, const char *format, ...) +{ + int len; + va_list args; + va_start(args, format); + len = vsnprintf(buffer, count, format, args); + va_end(args); + if (len < 0) { + len = count + 1; + } + return len; +} + diff -Nru exifprobe-2.0.1/x3f.c exifprobe-2.0.1+git20170416.3c2b769/x3f.c --- exifprobe-2.0.1/x3f.c 2005-07-24 20:31:30.000000000 +0000 +++ exifprobe-2.0.1+git20170416.3c2b769/x3f.c 2017-04-16 19:22:54.000000000 +0000 @@ -263,7 +263,7 @@ /* as an argument to lower-level functions. Just set */ /* it here. */ byteorder = TIFF_INTEL; - if(fseek(inptr,-4L,2) == 0) + if(fseek(inptr,-4L,SEEK_END) == 0) directory_pointer = ftell(inptr); if(ferror(inptr) == 0) { @@ -1202,7 +1202,7 @@ /* Print the index of name/value offsets first */ for(i = 0; i < num_entries; ++i) { - if(fseek(inptr,offset,0) == 0) + if(fseek(inptr,offset,SEEK_SET) == 0) { name_offset = read_ulong(inptr,byteorder,HERE); name_offset *= 2; @@ -1290,7 +1290,7 @@ /* Read 'em again, and this time show the names and values */ for(i = 0; i < num_entries; ++i) { - if(fseek(inptr,offset,0) == 0) + if(fseek(inptr,offset,SEEK_SET) == 0) { name_offset = read_ulong(inptr,byteorder,HERE); name_offset *= 2; @@ -1365,7 +1365,7 @@ if(inptr) { clearerr(inptr); - if(fseek(inptr,name_offset,0) == 0) + if(fseek(inptr,name_offset,SEEK_SET) == 0) { if((PRINT_SECTION) && (PRINT_VALUE_AT_OFFSET)) { @@ -1420,7 +1420,7 @@ } if((PRINT_SECTION) && (PRINT_VALUE_AT_OFFSET)) chpr = newline(chpr); - if(fseek(inptr,value_offset,0) == 0) + if(fseek(inptr,value_offset,SEEK_SET) == 0) { if((PRINT_SECTION) && (PRINT_VALUE_AT_OFFSET)) {