Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2404)

Unified Diff: libexif/sources/libexif/exif-entry.c

Issue 10792004: Fetch libexif 0.6.21 to include the security fixes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « libexif/sources/libexif/exif-data.c ('k') | libexif/sources/libexif/exif-tag.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: libexif/sources/libexif/exif-entry.c
===================================================================
--- libexif/sources/libexif/exif-entry.c (revision 143189)
+++ libexif/sources/libexif/exif-entry.c (working copy)
@@ -1351,11 +1351,24 @@
case EXIF_TAG_XP_AUTHOR:
case EXIF_TAG_XP_KEYWORDS:
case EXIF_TAG_XP_SUBJECT:
- /* Warning! The texts are converted from UTF16 to UTF8 */
- /* FIXME: use iconv to convert into the locale encoding */
- exif_convert_utf16_to_utf8(val, (unsigned short*)e->data, MIN(maxlen, e->size));
- break;
+ {
+ /* Sanity check the size to prevent overflow */
+ if (e->size+sizeof(unsigned short) < e->size) break;
+
+ /* The tag may not be U+0000-terminated , so make a local
+ U+0000-terminated copy before converting it */
+ unsigned short *utf16 = exif_mem_alloc (e->priv->mem, e->size+sizeof(unsigned short));
+ if (!utf16) break;
+ memcpy(utf16, e->data, e->size);
+ utf16[e->size/sizeof(unsigned short)] = 0;
+ /* Warning! The texts are converted from UTF16 to UTF8 */
+ /* FIXME: use iconv to convert into the locale encoding */
+ exif_convert_utf16_to_utf8(val, utf16, maxlen);
+ exif_mem_free(e->priv->mem, utf16);
+ break;
+ }
+
default:
/* Use a generic value formatting */
exif_entry_format_value(e, val, maxlen);
« no previous file with comments | « libexif/sources/libexif/exif-data.c ('k') | libexif/sources/libexif/exif-tag.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698