tdf#154285 Check upper bound of arguments in SbRtl_Minute function
[LibreOffice.git] / basic / qa / basic_coverage / test_tdf150137_parse_fail.bas
blobfdf9f1e9948e358ee90f14b8b72babcd52eae6c5
2 ' This file is part of the LibreOffice project.
4 ' This Source Code Form is subject to the terms of the Mozilla Public
5 ' License, v. 2.0. If a copy of the MPL was not distributed with this
6 ' file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 Option Explicit
11 Function doUnitTest() As String
12 On Error GoTo ErrorHandler ' Set up error handler
14 Dim Xml As String
15 Dim XmlLen As Long
16 ' Not namespace-well-formed XML, parse is expected to fail
17 Xml = "<a:xml/>"
18 XmlLen = Len(Xml)
19 Dim XmlByte(1 To XmlLen) As Byte
20 Dim Index As Integer
21 For Index = 1 To XmlLen
22 XmlByte(Index) = Asc(Mid(Xml, Index, 1))
23 Next
24 Dim source As Object
25 source = CreateUnoStruct("com.sun.star.xml.sax.InputSource")
26 source.aInputStream = com.sun.star.io.SequenceInputStream.createStreamFromSequence(XmlByte)
27 Dim parser As Object
28 parser = CreateUnoService("com.sun.star.xml.sax.FastParser")
29 ' Parse crashed before the fix
30 parser.ParseStream(source)
32 ' Shouldn't end up here
33 doUnitTest = "FAIL"
34 Exit Function
35 ErrorHandler:
36 doUnitTest = "OK"
37 End Function