~ubuntu-branches/ubuntu/utopic/libexif/utopic-proposed

« back to all changes in this revision

Viewing changes to libexif/canon/exif-mnote-data-canon.c

  • Committer: Bazaar Package Importer
  • Author(s): Emmanuel Bouthenot
  • Date: 2009-04-19 17:53:15 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20090419175315-2h14ges5fp4yqtvg
Tags: 0.6.17-1
* Adopt the package within pkg-phototools:
  - Set the Maintainer to the group
  - Add Frederic Peters and myself as Uploaders.
  - Add Vcs-Browser and Vcs-Git fields accordingly.
* New upstream release:
  - remove patches merged upsteam:
    + 30_olympus_makernote.dpatch
    + 40_crash_looking_up_invalid_values.dpatch
    + 50_relibtoolize.dpatch
    + CVE-2007-6351.dpatch
    + CVE-2007-6352.dpatch
  - convert existing patches from dpatch to quilt.
  - Fix a bug while reading exif datas in some cases (Closes: #447907)
* Switch packaging to debhelper 7
* Update debian/control:
  - Drop duplicate section field for exif12
  - Bump Standards-Version to 3.8.1
  - Replace deprecated ${Source-Version} by ${binary:Version}
  - Enhance libexif-dev long description.
  - Add homepage field.
  - Add DM-Upload-Allowed field.
* Force remove of files not fully cleaned
* Remove empty doc files in libexif-dev.
* Update debian/copyright.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* exif-mnote-data-canon.c
2
2
 *
3
 
 * Copyright � 2002, 2003 Lutz M�ller <lutz@users.sourceforge.net>
4
 
 * Copyright � 2003 Matthieu Castet <mat-c@users.sourceforge.net>
 
3
 * Copyright (c) 2002, 2003 Lutz Mueller <lutz@users.sourceforge.net>
 
4
 * Copyright (c) 2003 Matthieu Castet <mat-c@users.sourceforge.net>
5
5
 *
6
6
 * This library is free software; you can redistribute it and/or
7
7
 * modify it under the terms of the GNU Lesser General Public
118
118
        unsigned char **buf, unsigned int *buf_size)
119
119
{
120
120
        ExifMnoteDataCanon *n = (ExifMnoteDataCanon *) ne;
121
 
        unsigned int i, o, s, doff;
 
121
        size_t i, o, s, doff;
 
122
        unsigned char *t;
 
123
        size_t ts;
122
124
 
123
125
        if (!n || !buf || !buf_size) return;
124
126
 
143
145
                o += 8;
144
146
                s = exif_format_get_size (n->entries[i].format) *
145
147
                                                n->entries[i].components;
 
148
                if (s > 65536) {
 
149
                        /* Corrupt data: EXIF data size is limited to the
 
150
                         * maximum size of a JPEG segment (64 kb).
 
151
                         */
 
152
                        continue;
 
153
                }
146
154
                if (s > 4) {
147
 
                        *buf_size += s;
 
155
                        ts = *buf_size + s;
148
156
 
149
157
                        /* Ensure even offsets. Set padding bytes to 0. */
150
 
                        if (s & 1) *buf_size += 1;
151
 
                        *buf = exif_mem_realloc (ne->mem, *buf,
152
 
                                                 sizeof (char) * *buf_size);
153
 
                        if (!*buf) return;
 
158
                        if (s & 1) ts += 1;
 
159
                        t = exif_mem_realloc (ne->mem, *buf,
 
160
                                                 sizeof (char) * ts);
 
161
                        if (!t) return;
 
162
                        *buf = t;
 
163
                        *buf_size = ts;
154
164
                        doff = *buf_size - s;
155
165
                        if (s & 1) { doff--; *(*buf + *buf_size - 1) = '\0'; }
156
166
                        exif_set_long (*buf + o, n->order, n->offset + doff);
185
195
{
186
196
        ExifMnoteDataCanon *n = (ExifMnoteDataCanon *) ne;
187
197
        ExifShort c;
188
 
        unsigned int i, o, s;
 
198
        size_t i, o, s;
 
199
        MnoteCanonEntry *t;
189
200
 
190
201
        if (!n || !buf || !buf_size || (buf_size < 6 + n->offset + 2)) return;
191
202
 
198
209
                o = 6 + 2 + n->offset + 12 * i;
199
210
          if (o + 8 > buf_size) return;
200
211
 
 
212
                t = exif_mem_realloc (ne->mem, n->entries,
 
213
                                sizeof (MnoteCanonEntry) * (i + 1));
 
214
                if (!t) return;
201
215
                n->count = i + 1;
202
 
                n->entries = exif_mem_realloc (ne->mem, n->entries,
203
 
                                sizeof (MnoteCanonEntry) * (i+1));
 
216
                n->entries = t;
204
217
                memset (&n->entries[i], 0, sizeof (MnoteCanonEntry));
205
218
          n->entries[i].tag        = exif_get_short (buf + o, n->order);
206
219
          n->entries[i].format     = exif_get_short (buf + o + 2, n->order);