找回密码
 点一下
查看: 2246|回复: 19

最新发现:1.23b后return bug仍然存在!

[复制链接]
发表于 2009-6-24 01:50:53 | 显示全部楼层 |阅读模式
common.j 中有:
type version            extends     handle
constant native ConvertVersion              takes integer i returns version

Convert系列函数实际上就是类型转换,而不是从内部读取数据。
例如ConvertVersion(1) 就是1,只不过类型变成了version

由于extends没有实际意义,只是作为类型继承判断,即使改掉后面的extends xx也不影响使用。我们知道,type a extends b,则a是一个b,而b不是一个a。例如type unit extends handle,每个unit都是handle。

在common.j 中修改成:
type version            extends     code

这毫不影响version相关函数的运行。更何况 type code extends handle

于是ConvertVersion函数实际上就变成了I2C!这时version是code,所以得到的version可以直接转换为code或者用在code参数中。类似的Convert函数还有很多个,足够把常用的I2H类型全部写一遍,而后在地图中引入修改的scripts\common.j

评分

参与人数 1威望 +5 收起 理由
血戮魔动冰 + 5

查看全部评分

发表于 2009-6-24 02:02:04 | 显示全部楼层
所以漏洞还是可以利用的?
回复

使用道具 举报

 楼主| 发表于 2009-6-24 02:02:25 | 显示全部楼层
思路扩展一下,还有更猥琐的方法

对于所有的type xxx extends handle,可以如下修改:

type handlenew extends unit
type unit extends item
type item extends destructable
type destructable extends widget
type widget extends trigger
type trigger extends timer
type timer extends ....

...

最后extends handle。

这个handlenew是新定义的类型,他实际上就是任意的handle类型,可以用在任何unit, timer, trigger做参数的地方,而return bug函数也只需要1个,I2H,转化为handlenew就够了,既然handlenew可以当作unit参数,当作item参数,当作timer参数,当作trigger参数来用,也就不需要把他再转化成对应的类型了。
回复

使用道具 举报

发表于 2009-6-24 02:14:50 | 显示全部楼层
测试地图

ewr.w3x

51 KB, 下载次数: 30

回复

使用道具 举报

 楼主| 发表于 2009-6-24 05:20:29 | 显示全部楼层
更新:在1.23b试验以后,发现不能extends code。看起来code已经与handle完全脱离关系了。但是可以用这个方法来I2U, I2Timer等。

原来code从来都不是handle。。。我愚昧了

那么这个方法的确只能转换integer和handle,因为extends code是不行的

另外一点,在1.23及以前,extends的双方是可以互相转换的,例如可以把unit转成handle,但也可以在takes handle的函数中return unit。1.23b里这样做是不行的,只能向上typecast而不能向下。
回复

使用道具 举报

发表于 2009-6-24 07:32:35 | 显示全部楼层
明白了…………原来是这样:
[jass]
type version            extends     handle
constant native ConvertVersion              takes integer i returns version
[/jass]
改成:
[jass]
type version            extends     unit
constant native ConvertVersion              takes integer i returns version
[/jass]
使用是这样:
[jass]
function I2U takes integer i returns unit
    return ConvertVersion( i )
endfunction
[/jass]
这样的吧………………
回复

使用道具 举报

发表于 2009-6-24 07:33:36 | 显示全部楼层
至于那个3楼不断嵌套type的东东…………还真是邪恶呢…………
回复

使用道具 举报

 楼主| 发表于 2009-6-24 07:35:23 | 显示全部楼层
就是这样.. 然后那几十个convert对应的类型全都可以改一下 变成几十个I2各种handle。。
回复

使用道具 举报

发表于 2009-6-24 08:19:51 | 显示全部楼层
code和handle的区别正如string和handle的区别~~

本来就不是一个系统的。
回复

使用道具 举报

发表于 2009-6-24 12:56:55 | 显示全部楼层
会不会因为这个问题,1.23b又会推迟几天出来。。。
回复

使用道具 举报

发表于 2009-6-25 12:19:52 | 显示全部楼层
让我们静静地等待,伟大的BLZ,出1.23c补丁!
回复

使用道具 举报

发表于 2009-6-25 12:52:54 | 显示全部楼层
我还是喜欢UNION BUG
回复

使用道具 举报

发表于 2009-6-25 16:08:02 | 显示全部楼层
我讨厌U_Bug....
回复

使用道具 举报

发表于 2009-6-25 23:35:57 | 显示全部楼层
老版的
[codes=Jass]
function I2U takes integer i returns unit
    return i
    return null
endfunction
[/codes]
和新版的
[codes=jass]
function I2U takes integer i returns unit
     return ConvertVersion(i)
endfunction
[/codes]
好像都没有什么区别啊 我linzefei的测试,用1.23不是照样都能成功吗?
回复

使用道具 举报

发表于 2009-6-25 23:39:06 | 显示全部楼层
1.23是没什么问题,但暴雪会推出新版本,禁止return bug那样的强制类型转换
回复

使用道具 举报

发表于 2009-6-25 23:40:48 | 显示全部楼层
新方法只适用于1.23以上版本?
回复

使用道具 举报

发表于 2009-6-25 23:41:54 | 显示全部楼层
是原来的return bug将不适用与将来的版本
回复

使用道具 举报

发表于 2009-6-25 23:44:36 | 显示全部楼层
额 ... 那中国这个国家不是很尴尬..  作图的都不知道是用新BUG 还是老BUG
算了 研究数据结构用其他的好了
回复

使用道具 举报

发表于 2009-6-25 23:46:17 | 显示全部楼层
反正将来很多图需要大改就是了
return bug+gamecache应该会被hashtable取代的吧
回复

使用道具 举报

发表于 2009-6-25 23:51:02 | 显示全部楼层
我的图啊.. 拖拖拉拉做了一年.从T改到JASS 从JASS改到VJASS ,.看样子又要大改  阿门
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-4-25 00:43 , Processed in 0.256715 second(s), 25 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表