39 lines
1.2 KiB
Diff
39 lines
1.2 KiB
Diff
|
|
Backported of:
|
||
|
|
|
||
|
|
From 7798ae25574425271305fffe85de77bec8df03f1 Mon Sep 17 00:00:00 2001
|
||
|
|
From: Kevin Backhouse <kev@semmle.com>
|
||
|
|
Date: Wed, 15 May 2019 10:12:02 +0100
|
||
|
|
Subject: [PATCH] Throw an exception if the data location is invalid. (#842)
|
||
|
|
diff --git a/src/crwimage.cpp b/src/crwimage.cpp
|
||
|
|
index 9225ce5..5ccf3b1 100644
|
||
|
|
--- a/src/crwimage.cpp
|
||
|
|
+++ b/src/crwimage.cpp
|
||
|
|
@@ -738,12 +738,11 @@ namespace Exiv2 {
|
||
|
|
|
||
|
|
DataLocId CiffComponent::dataLocation(uint16_t tag)
|
||
|
|
{
|
||
|
|
- DataLocId di = invalidDataLocId;
|
||
|
|
switch (tag & 0xc000) {
|
||
|
|
- case 0x0000: di = valueData; break;
|
||
|
|
- case 0x4000: di = directoryData; break;
|
||
|
|
+ case 0x0000: return valueData;
|
||
|
|
+ case 0x4000: return directoryData;
|
||
|
|
+ default: throw Error(kerCorruptedMetadata);
|
||
|
|
}
|
||
|
|
- return di;
|
||
|
|
} // CiffComponent::dataLocation
|
||
|
|
|
||
|
|
/*!
|
||
|
|
diff --git a/src/crwimage_int.hpp b/src/crwimage_int.hpp
|
||
|
|
index 5588ae5..1478c82 100644
|
||
|
|
--- a/src/crwimage_int.hpp
|
||
|
|
+++ b/src/crwimage_int.hpp
|
||
|
|
@@ -78,7 +78,6 @@ namespace Exiv2 {
|
||
|
|
|
||
|
|
//! Type to identify where the data is stored in a directory
|
||
|
|
enum DataLocId {
|
||
|
|
- invalidDataLocId,
|
||
|
|
valueData,
|
||
|
|
directoryData,
|
||
|
|
lastDataLocId
|