summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tlillqvist@suse.com>2012-08-14 12:33:52 +0200
committerDavid Tardon <dtardon@redhat.com>2012-08-15 06:23:57 +0200
commit81db599486053dacb453bf6532406000f7a19c52 (patch)
treeaf186d80b76f476c390325e6435643c8cb054292
parent7910c47221d07e836d62b7d816e1afe19859b601 (diff)
Be more careful in recognizing MathML (bnc#774921)
Change-Id: I82c36a3ff49f74dc674df46dcf35f8c1a991c9e2 (cherry picked from commit aa4b8a8164f01a120ba9bfb2e86b1ed33cc1d69c) Signed-off-by: David Tardon <dtardon@redhat.com>
-rw-r--r--starmath/source/smdetect.cxx18
1 files changed, 14 insertions, 4 deletions
diff --git a/starmath/source/smdetect.cxx b/starmath/source/smdetect.cxx
index 05f6056821c5..2f157f425e89 100644
--- a/starmath/source/smdetect.cxx
+++ b/starmath/source/smdetect.cxx
@@ -322,10 +322,20 @@ SmFilterDetect::~SmFilterDetect()
{
if (0 == strncmp( "<?xml",aBuffer,nSize))
{
- static const sal_Char sFltrNm_2[] = MATHML_XML;
- static const sal_Char sTypeNm_2[] = "math_MathML_XML_Math";
- aFilterName.AssignAscii( sFltrNm_2 );
- aTypeName.AssignAscii( sTypeNm_2 );
+ // 200 should be enough for the XML
+ // version, encoding and !DOCTYPE
+ // stuff I hope?
+ sal_Char aBuffer2[200];
+ nBytesRead = pStrm->Read( aBuffer2, sizeof(aBuffer2) - 1);
+ aBuffer2[nBytesRead] = 0;
+ if (strstr( aBuffer2, "<math>" ) != NULL ||
+ strstr( aBuffer2, "<math " ) != NULL)
+ {
+ static const sal_Char sFltrNm_2[] = MATHML_XML;
+ static const sal_Char sTypeNm_2[] = "math_MathML_XML_Math";
+ aFilterName.AssignAscii( sFltrNm_2 );
+ aTypeName.AssignAscii( sTypeNm_2 );
+ }
}
}
}