Skip to content

Commit

Permalink
fixed: make sure libexif is using the correct byte order (intel or mo…
Browse files Browse the repository at this point in the history
…torola) when processing gps information (fixes #8427)
  • Loading branch information
mkortstiege committed Aug 1, 2011
1 parent f29e6b5 commit 00e3095
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/libexif/ExifParse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -810,15 +810,15 @@ void CExifParse::ProcessGpsInfo(
const unsigned char* const OffsetBase,
unsigned ExifLength)
{
int NumDirEntries = Get16(DirStart);
int NumDirEntries = Get16(DirStart, m_MotorolaOrder);

for (int de=0;de<NumDirEntries;de++)
{
const unsigned char* DirEntry = DIR_ENTRY_ADDR(DirStart, de);

unsigned Tag = Get16(DirEntry);
unsigned Format = Get16(DirEntry+2);
unsigned Components = (unsigned)Get32(DirEntry+4);
unsigned Tag = Get16(DirEntry, m_MotorolaOrder);
unsigned Format = Get16(DirEntry+2, m_MotorolaOrder);
unsigned Components = (unsigned)Get32(DirEntry+4, m_MotorolaOrder);
if ((Format-1) >= NUM_FORMATS)
{
// (-1) catches illegal zero case as unsigned underflows to positive large.
Expand All @@ -834,7 +834,7 @@ void CExifParse::ProcessGpsInfo(

if (ByteCount > 4)
{
unsigned OffsetVal = (unsigned)Get32(DirEntry+8);
unsigned OffsetVal = (unsigned)Get32(DirEntry+8, m_MotorolaOrder);
// If its bigger than 4 bytes, the dir entry contains an offset.
if (OffsetVal+ByteCount > ExifLength)
{
Expand Down Expand Up @@ -878,7 +878,7 @@ void CExifParse::ProcessGpsInfo(
case TAG_GPS_ALT:
{
char temp[18];
sprintf(temp,"%dm", Get32(ValuePtr));
sprintf(temp,"%dm", Get32(ValuePtr, m_MotorolaOrder));
strcat(m_ExifInfo->GpsAlt, temp);
}
break;
Expand Down

0 comments on commit 00e3095

Please sign in to comment.