Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions exif.c
Original file line number Diff line number Diff line change
Expand Up @@ -1233,6 +1233,19 @@ void create_EXIF(void)
}
}

//--------------------------------------------------------------------------
// Check the range of the memory block pointed by ptr contains OrientationPtr or not.
// Return 1 if contains at least one OrientationPtr
//--------------------------------------------------------------------------

int CheckOrientationPtrs(unsigned char * ptr, unsigned int range){
if((OrientationPtr[0] >= (void *)ptr) && (OrientationPtr[0] < (void *)ptr+range))
return 1;
if((OrientationPtr[1] >= (void *)ptr) && (OrientationPtr[1] < (void *)ptr+range))
return 1;
return 0;
}

//--------------------------------------------------------------------------
// Clear the rotation tag in the exif header to 1.
// Returns NULL if no orientation tag exists.
Expand Down
1 change: 1 addition & 0 deletions jhead.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ void Clear_EXIF();
int process_EXIF (unsigned char * CharBuf, int length);
void ShowImageInfo(int ShowFileInfo);
void ShowConciseImageInfo(void);
int CheckOrientationPtrs(unsigned char * ptr, unsigned int range);
const char * ClearOrientation(void);
void PrintFormatNumber(void * ValuePtr, int Format, int ByteCount);
double ConvertAnyFormat(void * ValuePtr, int Format);
Expand Down
6 changes: 4 additions & 2 deletions jpgfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,9 @@ int ReplaceThumbnail(const char * ThumbFileName)
return FALSE;
}

ThumbLen = 0;
ThumbLen = 0;


ThumbnailFile = NULL;
}

Expand Down Expand Up @@ -538,7 +540,7 @@ void DiscardAllButExif(void)
CommentKeeper = Sections[a];
}else if (Sections[a].Type == M_IPTC && IptcKeeper.Type == 0){
IptcKeeper = Sections[a];
}else{
}else if (CheckOrientationPtrs(Sections[a].Data, Sections[a].Size+20) == 0){
free(Sections[a].Data);
}
}
Expand Down