mIRC Home    About    Download    Register    News    Help

Print Thread
#261343 02/09/17 11:45 PM
Joined: Jul 2006
Posts: 4,149
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
While discussing why $left($str(x,4000) $str(y,4000),4000) was ignoring the $str(y,4000) part, I found this crash:

Code:
//alias ^ echo -a $!len($1-) | noop $^($str(x,4150),$str(y,X)) | alias ^
where X can probably be 1 and it would still crash, however since I believe it depends on the current memory usage/state, you have more chance of reproducing with a bigger X, usually 250 does it, but certainly the maximum 4150 should do it.

I was arguing prior testing that $1- would probably be truncated to 4150 characters, however in some cases the /echo will be displayed and we can see the 'correct sum' value of 4150+X+1 (+1 for the space added by $1-).

I am still looking for an explanation as to why mIRC, internally, is not throwing an error for when computing the parameter '$str(x,4000) $str(y,4000)' in the first example.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Dec 2002
Posts: 5,420
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,420
Thanks for your bug report. This issue has been fixed for the next version.

Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
Originally Posted By: Khaled
Thanks for your bug report. This issue has been fixed for the next version.


Khaled, is there a way to use $left(%long_string %longer_string, 4000) to manage a rolling string buffer that doesn't exceed variable limits? Can you modify $left $right $mid to accept and chop long input strings? The current behavior is to quietly ignore inputs after it encounters one that makes the line too long, or fails with error if $+ concatenation is used.

//var %a = $str(a,500), %b = $str(b,500), %c = $str(c,3500), %d = $str(d,100) | echo -a $left(%a %b %c %d eeeeeeeee,4000)

%a and %b evaluates but not %c and not %d and "eeeeeeeee" is also ignored. Total string length is 1001 but not 4000.

My supposed solution, which causes this reported crash, is thus.

ALIAS left4k { return $left($1-,4000) }

//var %a = $str(a,500), %b = $str(b,500), %c = $str(c,3500), %d = $str(d,100) | echo -a $left4k(%a,%b,%c,%d,eeeeeeeee)
(^ warning: crash hazard.)


Well. At least I won lunch.
Good philosophy, see good in bad, I like!

Link Copied to Clipboard