replacetext returns odd results or crashes when passed odd, but valid arguments
Numbered Steps to Reproduce Problem:
- Try replacetext("a", md5("1"), "b") and receive either '1' or the name of the proc you ran it in
- Try replacetext("a", "", "b") and receive BUG output
Code Snippet (if applicable) to Reproduce Problem:
#define DEBUG
/world/New()
testA()
testB()
testC()
/proc/testA()
var/a = replacetext("a", md5("1"), "b")
world.log << "a: '[a]'"
/proc/testB()
var/b = replacetext("a", md5("12"), "b")
world.log << "b: '[b]'"
/proc/testC()
var/c = replacetext("a", "", "b")
world.log << "c: '[c]'"
Expected Results: The same output as in 512.1488:
a: 'a'
b: 'a'
c: 'ba'
Actual Results:
a: '/proc/testA' // this is sometimes '1', but I'm not sure why or how to reproduce this
b: '/proc/testB'
BUG: Crashing due to an illegal operation!
proc name: testC (/proc/testC)
source file: test.dme,17
usr: (src)
src: null
call stack:
testC()
world: New()
Backtrace for BYOND 513.1501 on Linux:
Generated at Wed Nov 27 20:37:37 2019
DreamDaemon [0x8048000, 0x0], [0x8048000, 0x804bd94]
libc.so.6 [0xf71e5000, 0x0], 0x14dd46
linux-gate.so.1 [0xf7f18000, 0xf7f18950], [0xf7f18000, 0xf7f18950]
libc.so.6 [0xf71e5000, 0x0], 0x14dd46
libbyond.so 0x39fd50, 0x39fda6
libbyond.so [0xf7915000, 0x0], 0x2d13ce
libbyond.so [0xf7915000, 0x0], 0x2c5e67
libbyond.so [0xf7915000, 0x0], 0x2cfa12
libbyond.so [0xf7915000, 0x0], 0x2adf7e
libbyond.so [0xf7915000, 0x0], 0x2cd984
libbyond.so [0xf7915000, 0x0], 0x2da523
libbyond.so [0xf7915000, 0x0], 0x2da82b
libbyond.so [0xf7915000, 0x0], 0x2818d6
libbyond.so [0xf7915000, 0x0], 0x2840eb
libbyond.so [0xf7915000, 0x0], 0x27ebd1
libbyond.so [0xf7915000, 0x0], 0x27f63e
libbyond.so 0x302f90, 0x302fd7
DreamDaemon [0x8048000, 0x0], [0x8048000, 0x804aeff]
libc.so.6 0x1eeb0, 0x1efa9 (__libc_start_main)
DreamDaemon [0x8048000, 0x0], [0x8048000, 0x804a801]
Recent proc calls:
/proc/testC
/proc/testB
/proc/testA
/world/New
Does the problem occur:
Every time? Or how often? Every time
In other games? Yes
In other user accounts? Yes
On other computers? Yes
When does the problem NOT occur? When either md5() is not used, or the "find" argument to replacetext() is not empty.
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked?
Works fully in 512.1488.
testA and testB don't work starting in 513.1490, but testC does.
testC first breaks in 513.1493.
Workarounds: Don't do this?