Skip to content

Commit 9142ab3

Browse files
committed
Merge remote-tracking branch 'upstream/develop-9.0' into merge-develop-9.0-15.05.2019
2 parents e2d9abe + 028f80b commit 9142ab3

File tree

8 files changed

+195
-51
lines changed

8 files changed

+195
-51
lines changed

docs/lcb/notes/22063.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# [22063] Ensure nothing can be passed to an optional foreign handler type parameter

docs/notes/bugfix-20027.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Fix value assignment to undeclared variable in matchText

docs/notes/bugfix-21941.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Fix local-ref overflow when repeatedly calling Java from LCB on older Android OSes

engine/src/variable.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,8 @@ bool MCContainer::remove(MCExecContext& ctxt)
11041104

11051105
bool MCContainer::set_valueref(MCValueRef p_value)
11061106
{
1107-
return m_variable -> setvalueref(getpath(), false, p_value);
1107+
m_variable -> clearuql();
1108+
return m_variable -> setvalueref(getpath(), false, p_value);
11081109
}
11091110

11101111
MCValueRef MCContainer::get_valueref()

libfoundation/src/foundation-java-private.cpp

Lines changed: 121 additions & 49 deletions
Large diffs are not rendered by default.

libscript/src/script-execute.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1224,7 +1224,8 @@ MCScriptExecuteContext::UnboxingConvert(MCValueRef p_value,
12241224
}
12251225
}
12261226
else if (MCTypeInfoIsHandler(p_slot_type.type) &&
1227-
MCHandlerTypeInfoIsForeign(p_slot_type.type))
1227+
MCHandlerTypeInfoIsForeign(p_slot_type.type) &&
1228+
p_value != kMCNull)
12281229
{
12291230
// If the slot type is a foreign handler, then we fetch a closure
12301231
// from the handler value.

tests/lcb/vm/native-callback.lcb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,23 @@ public handler TestNativeCallback()
5858
test "use function pointer" when sTotal is (1 + 2 + 3 + 4 + 5 + 6)
5959
end handler
6060

61+
--------- NULLPTR FUNCTION PTRS
62+
63+
foreign handler type DummyHandlerType() returns nothing
64+
65+
/* To test whether nothing can be passed as an optional handler type value we
66+
* need any function which takes a pointer, but will ignore it. */
67+
foreign handler MCDataCreateWithBytes(in pPointer as optional DummyHandlerType, in pLength as LCUIndex, out rData as Data) returns CBool binds to "<builtin>"
68+
69+
public handler TestNullptrNativeCallback()
70+
variable tDummyHandler as optional DummyHandlerType
71+
variable tDummyData as optional Data
72+
unsafe
73+
MCDataCreateWithBytes(tDummyHandler, 0, tDummyData)
74+
end unsafe
75+
test "use nothing as optional function pointer" when tDummyData is not nothing
76+
end handler
77+
6178
--------- FOREIGN HANDLER FUNCTION PTRS
6279

6380
-- This test checks that it is possible to pass foreign handlers around as
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
script "CoreExecutionUQL"
2+
/*
3+
Copyright (C) 2018 LiveCode Ltd.
4+
5+
This file is part of LiveCode.
6+
7+
LiveCode is free software; you can redistribute it and/or modify it under
8+
the terms of the GNU General Public License v3 as published by the Free
9+
Software Foundation.
10+
11+
LiveCode is distributed in the hope that it will be useful, but WITHOUT ANY
12+
WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
18+
19+
on TestUQLPut
20+
put "foo" into tTest1
21+
TestAssert "unquoted literal put into", tTest1 is "foo"
22+
put "foo" after tTest2
23+
TestAssert "unquoted literal put after", tTest2 is "foo"
24+
put "foo" before tTest3
25+
TestAssert "unquoted literal put before", tTest3 is "foo"
26+
end TestUQLPut
27+
28+
on TestUQLValue
29+
TestAssert "unquoted literal value", tTest1 is "tTest1"
30+
end TestUQLValue
31+
32+
on TestUQLMatchText
33+
put "rangeInt={0,3}" into tVar
34+
get matchText(tVar,"(.*?)={(.*?)}", tOption, tValue)
35+
TestAssert "matchText assigns correct values to UQL", \
36+
tOption is "rangeInt" and tValue is "0,3"
37+
end TestUQLMatchText
38+
39+
on TestUQLBinaryDecode
40+
get binaryDecode("h*",sha1Digest("foobar"), tFoobar)
41+
TestAssert "binaryDecode assigns correct values to UQL", \
42+
tFoobar is "88347d9f426112d19ebe9b36ffc42e1852398287"
43+
end TestUQLBinaryDecode
44+
45+
on TestUQLQueryRegistry
46+
TestSkipIfNot "platform", "win32"
47+
get queryRegistry("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\ProgramFilesDir", tType)
48+
TestAssert "queryRegistry assigns correct values to UQL", \
49+
tType is "string"
50+
end TestUQLQueryRegistry

0 commit comments

Comments
 (0)