Skip to content

Bug - llGetSubString and llList2List make wrong result on negative out of range index (when Optimizations are enabled) #35

Closed
@PellSmit

Description

@PellSmit

(1)

// OutOfRangeNegativeIndex.lslp
default
{
	state_entry()
	{
		string s = llGetSubString("0123456789", -11, -11);
		llOwnerSay("s = " + s + ", length = " + (string)llStringLength(s));
		list l = llList2List([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], -11, -11);
		llOwnerSay("l = [" + llDumpList2String(l, ", ") + "]");
	}
}

was converted to

(2)

// OutOfRangeNegativeIndex.lslp 
// 2016-11-11 13:40:30 - LSLForge (0.1.9) generated
// OutOfRangeNegativeIndex.lslp
default {

	state_entry() {
    string s = "0";
    llOwnerSay(((("s = " + s) + ", length = ") + ((string)llStringLength(s))));
    list l = [0];
    llOwnerSay((("l = [" + llDumpList2String(l,", ")) + "]"));
  }
}

But result of (1) is:
[20:31] Object: s = , length = 0
[20:31] Object: l = []

and (2)
[20:32] Object: s = 0, length = 1
[20:32] Object: l = [0]

It is a bug in InternalLLFuncs.hs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions