office-gobmx/libcdr/libcdr-issupported-exception.patch.1
Michael Stahl 374f746572 rhbz#891082: CMXDocument::isSupported: catch exceptions
Change-Id: I715975dfa93d736cb537076feab4afe6b75c162a
2013-01-04 23:58:16 +01:00

43 lines
1.3 KiB
Groff

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;
}