projects
/
supertux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a7b404c
)
#324: Hopefully this fixes the issue with malformed UTF-8 sequences causing SuperTux...
author
Ryan Flegel
<rflegel@gmail.com>
Mon, 9 Jun 2008 02:06:05 +0000
(
02:06
+0000)
committer
Ryan Flegel
<rflegel@gmail.com>
Mon, 9 Jun 2008 02:06:05 +0000
(
02:06
+0000)
SVN-Revision: 5546
src/video/font.cpp
patch
|
blob
|
history
diff --git
a/src/video/font.cpp
b/src/video/font.cpp
index
50949b2
..
e0f5664
100644
(file)
--- a/
src/video/font.cpp
+++ b/
src/video/font.cpp
@@
-49,7
+49,12
@@
struct UTF8Iterator
: text(text_),
pos(0)
{
: text(text_),
pos(0)
{
- chr = decode_utf8(text, pos);
+ try {
+ chr = decode_utf8(text, pos);
+ } catch (std::exception) {
+ log_debug << "Malformed utf-8 sequence beginning with " << *((uint32_t*)(text.c_str() + pos)) << " found " << std::endl;
+ chr = 0;
+ }
}
bool done() const
}
bool done() const
@@
-60,7
+65,7
@@
struct UTF8Iterator
UTF8Iterator& operator++() {
try {
chr = decode_utf8(text, pos);
UTF8Iterator& operator++() {
try {
chr = decode_utf8(text, pos);
- } catch (std::
runtime_error
) {
+ } catch (std::
exception
) {
log_debug << "Malformed utf-8 sequence beginning with " << *((uint32_t*)(text.c_str() + pos)) << " found " << std::endl;
chr = 0;
++pos;
log_debug << "Malformed utf-8 sequence beginning with " << *((uint32_t*)(text.c_str() + pos)) << " found " << std::endl;
chr = 0;
++pos;