[tracker-miners/wip/carlosg/coverity-fixes: 11/28] tracker-extract: Stick to the first xmp/exif metadata found in JPEG extractor




commit a6743eb7a277ede628d4295d137f32f10c40c79c
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Oct 24 00:39:47 2021 +0200

    tracker-extract: Stick to the first xmp/exif metadata found in JPEG extractor
    
    We only stick to one, but this happens in a loop iterating for PNG
    metadata, so it sounds plausible that multiple headers might exist.
    If that is the case, pick the first ones found, instead of leaking
    old xmp/exif data in replacement for the new one.
    
    CID: #365655

 src/tracker-extract/tracker-extract-jpeg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-jpeg.c b/src/tracker-extract/tracker-extract-jpeg.c
index ce00e3155..b5ccc2ef3 100644
--- a/src/tracker-extract/tracker-extract-jpeg.c
+++ b/src/tracker-extract/tracker-extract-jpeg.c
@@ -227,13 +227,13 @@ tracker_extract_get_metadata (TrackerExtractInfo  *info,
                        len = marker->data_length;
 
 #ifdef HAVE_LIBEXIF
-                       if (strncmp (EXIF_NAMESPACE, str, EXIF_NAMESPACE_LENGTH) == 0) {
+                       if (!ed && strncmp (EXIF_NAMESPACE, str, EXIF_NAMESPACE_LENGTH) == 0) {
                                ed = tracker_exif_new ((guchar *) marker->data, len, uri);
                        }
 #endif /* HAVE_LIBEXIF */
 
 #ifdef HAVE_EXEMPI
-                       if (strncmp (XMP_NAMESPACE, str, XMP_NAMESPACE_LENGTH) == 0) {
+                       if (!xd && strncmp (XMP_NAMESPACE, str, XMP_NAMESPACE_LENGTH) == 0) {
                                xd = tracker_xmp_new (str + XMP_NAMESPACE_LENGTH,
                                                      len - XMP_NAMESPACE_LENGTH,
                                                      uri);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]