Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 24AA017FC7 for ; Sun, 17 Jan 2016 11:57:47 +0000 (UTC) Received: (qmail 42559 invoked by uid 500); 17 Jan 2016 11:57:40 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 42413 invoked by uid 500); 17 Jan 2016 11:57:40 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 42030 invoked by uid 99); 17 Jan 2016 11:57:40 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 17 Jan 2016 11:57:40 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 214112C1F74 for ; Sun, 17 Jan 2016 11:57:40 +0000 (UTC) Date: Sun, 17 Jan 2016 11:57:40 +0000 (UTC) From: "Simon Legner (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (IMAGING-179) Adding a directory causes "APP1 Segment is too long" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Simon Legner created IMAGING-179: ------------------------------------ Summary: Adding a directory causes "APP1 Segment is too long" Key: IMAGING-179 URL: https://issues.apache.org/jira/browse/IMAGING-179 Project: Commons Imaging Issue Type: Bug Components: Format: JPEG Reporter: Simon Legner SVN revision: 1696444 The following snippet causes {{ExifRewriter$ExifOverflowException: APP1 Segment is too long: 65548}} {code:java} final File in = new File("123.jpg"); final TiffImageMetadata exif = ((JpegImageMetadata) Imaging.getMetadata(in)).getExif(); final TiffOutputSet outputSet = exif.getOutputSet(); outputSet.getOrCreateGPSDirectory().add(GpsTagConstants.GPS_TAG_GPS_IMG_DIRECTION, RationalNumber.valueOf(123)); new ExifRewriter().updateExifMetadataLossless(in, new ByteArrayOutputStream(), outputSet); {code} When inspecting the EXIF data using {{jhead -exifmap 123.jpg}}, the header reveals unfilled space between 47198 and 65526. Nevertheless, this space is not used, but instead the GPS directory is being appended starting at offset 65526. {code} Map: 00008-00182: Directory Map: 00184-00202: Data for tag 010f Map: 00204-00214: Data for tag 0110 Map: 00216-00224: Data for tag 011a Map: 00224-00232: Data for tag 011b Map: 00232-00242: Data for tag 0131 Map: 00244-00264: Data for tag 0132 Map: 00264-00280: Data for tag 013e Map: 00280-00328: Data for tag 013f Map: 00328-00352: Data for tag 0211 Map: 00352-00850: Directory Map: 00852-00860: Data for tag 829a Map: 00860-00868: Data for tag 829d Map: 00868-00888: Data for tag 9003 Map: 00888-00908: Data for tag 9004 Map: 00908-00916: Data for tag 9102 Map: 00916-00924: Data for tag 9204 Map: 00924-00932: Data for tag 9205 Map: 00932-00940: Data for tag 920a Map: 01008-35518: Data for tag 927c Map: 00940-00984: Data for tag 9286 Map: 35518-35548: Directory Map: 00984-00992: Data for tag a302 Map: 00992-01000: Data for tag a404 Map: 01000-01008: Data for tag a500 Map: 35568-35658: Directory Map: 35660-35668: Data for tag 011a Map: 35668-35676: Data for tag 011b Map: 35676-47197: Thumbnail Map: 65526- End of exif {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)