Skip to content

Instantly share code, notes, and snippets.

@ivangrozni
Created March 29, 2022 14:17
Show Gist options
  • Save ivangrozni/d09025dfe0cce5473914f961de8e06c3 to your computer and use it in GitHub Desktop.
Save ivangrozni/d09025dfe0cce5473914f961de8e06c3 to your computer and use it in GitHub Desktop.
pel/pel php library for image metadata library
From 4c7adc422ac51384c1abd66c7db524e17558d883 Mon Sep 17 00:00:00 2001
From: Lio Novelli <liopold@drunomics.com>
Date: Sat, 26 Mar 2022 16:19:38 +0100
Subject: [PATCH] Gracefully handle offset not within boundaries error.
---
src/PelIfd.php | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/PelIfd.php b/src/PelIfd.php
index b703b4a2..b2bef165 100644
--- a/src/PelIfd.php
+++ b/src/PelIfd.php
@@ -1058,7 +1058,9 @@ private function safeSetThumbnail(PelDataWindow $d, $offset, $length)
try {
$this->setThumbnail($d->getClone($offset, $length));
} catch (PelDataWindowWindowException $e) {
- Pel::maybeThrow(new PelIfdException($e->getMessage()));
+ Pel::maybeThrow(new PelIfdException('PelDataWindowException: ' . $e->getMessage()));
+ } catch (PelDataWindowOffsetException $e) {
+ Pel::maybeThrow(new PelIfdException('PelDataWindowOffsetException: ' . $e->getMessage()));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment