blob: ee4ececab474fd11c5eba5b384d20669bbec9e34 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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;
}
|