Skip to content

Instantly share code, notes, and snippets.

@updateing
Created April 19, 2016 01:09
Show Gist options
  • Save updateing/2b58ebd4a8c75780443f28f514e9bb39 to your computer and use it in GitHub Desktop.
Save updateing/2b58ebd4a8c75780443f28f514e9bb39 to your computer and use it in GitHub Desktop.
From efdfdede52181591db3d85a8622bb79a1fb1262b Mon Sep 17 00:00:00 2001
From: Hamster Tian <[email protected]>
Date: Tue, 19 Apr 2016 09:08:21 +0800
Subject: [PATCH] Fix non-aligned memory access in ConvertAnyFormat
* Log indicated that the DOUBLE(Fmt=12) format was affected,
not sure if other formats are affected though.
Change-Id: I10b29bd54d350153fddd544e8a43711c2c48bb51
---
exif.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/exif.c b/exif.c
index 8dfdaf1..fa9fd99 100644
--- a/exif.c
+++ b/exif.c
@@ -453,7 +453,7 @@ double ConvertAnyFormat(void * ValuePtr, int Format)
// Not sure if this is correct (never seen float used in Exif format)
case FMT_SINGLE: Value = (double)*(float *)ValuePtr; break;
- case FMT_DOUBLE: Value = *(double *)ValuePtr; break;
+ case FMT_DOUBLE: memcpy(&Value, ValuePtr, sizeof(double));break;
default:
ErrNonfatal("Illegal format code %d",Format,0);
--
2.1.4
@kangear
Copy link

kangear commented Apr 20, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment