rhbz#891082: CMXDocument::isSupported: catch exceptions

Change-Id: I715975dfa93d736cb537076feab4afe6b75c162a
This commit is contained in:
Michael Stahl 2013-01-04 23:44:38 +01:00
parent 1c52268a5b
commit 374f746572
2 changed files with 44 additions and 0 deletions

View File

@ -15,6 +15,7 @@ $(eval $(call gb_UnpackedTarball_set_patchlevel,cdr,1))
$(eval $(call gb_UnpackedTarball_add_patches,cdr,\
libcdr/libcdr-configure.patch.1 \
libcdr/libcdr-issupported-exception.patch.1 \
libcdr/libcdr-msvc.patch \
))

View File

@ -0,0 +1,43 @@
rhbz#891082: CMXDocument::isSupported: catch exceptions
diff -ru cdr.old/src/lib/CMXDocument.cpp cdr/src/lib/CMXDocument.cpp
--- cdr.old/src/lib/CMXDocument.cpp
+++ cdr/src/lib/CMXDocument.cpp
@@ -46,20 +46,24 @@
*/
bool libcdr::CMXDocument::isSupported(WPXInputStream *input)
{
- input->seek(0, WPX_SEEK_SET);
- unsigned riff = readU32(input);
- if (riff != FOURCC_RIFF && riff != FOURCC_RIFX)
- return false;
- input->seek(4, WPX_SEEK_CUR);
- char signature_c = (char)readU8(input);
- if (signature_c != 'C' && signature_c != 'c')
- return false;
- char signature_d = (char)readU8(input);
- if (signature_d != 'M' && signature_d != 'm')
- return false;
- char signature_r = (char)readU8(input);
- if (signature_r != 'X' && signature_r != 'x')
+ try {
+ input->seek(0, WPX_SEEK_SET);
+ unsigned riff = readU32(input);
+ if (riff != FOURCC_RIFF && riff != FOURCC_RIFX)
+ return false;
+ input->seek(4, WPX_SEEK_CUR);
+ char signature_c = (char)readU8(input);
+ if (signature_c != 'C' && signature_c != 'c')
+ return false;
+ char signature_d = (char)readU8(input);
+ if (signature_d != 'M' && signature_d != 'm')
+ return false;
+ char signature_r = (char)readU8(input);
+ if (signature_r != 'X' && signature_r != 'x')
+ return false;
+ } catch (...) {
return false;
+ }
return true;
}