深层次了解 *** Object內部完成

访客4年前黑客文章563

在文中中,大家来剖析JavaScript在运行内存中的基础结构,另外了解一下在其中牵涉到的butterfly(蝶式)结构。

我们可以根据运行内存中的 *** Object结构来掌握JavaScriptCore內部完成。以前saelo早已在phrack的一篇文章中探讨过这些方面內容,但希望能运用上一篇文章中详细介绍的程序调试技术性来剖析这种知识要点。在上一篇文章中,大家迅速过去了一遍[1, 2, 3, 4]数组的运行内存结构,找到这种标值,但大家还发觉这种标值的上位统统被设定为0xffff,这儿大家来了解一下怎么会出現这类状况。

0x01 *** Value源码

JavaScript中有一个十分关键的类,能够用于解决各种各样标值: *** Value类。我们可以在 *** C *** Value.h源代码中见到类界定,依据类界定,此类应当能够解决多种类型值,如Integer、Double或是Boolean。

//[...]

bool isInt32() const;

bool isUInt32() const;

bool isDouble() const;

bool isTrue() const;

bool isFalse() const;

int32_t asInt32() const;

uint32_t asUInt32() const;

int64_t asAnyInt() const;

uint32_t asUInt32AsAnyInt() const;

int32_t asInt32AsAnyInt() const;

double asDouble() const;

bool asBoolean() const;

double asNumber() const;

//[...]

这一类中包括一个c语言编译器电源开关,对于32位及64位构架能够应用不一样的完成。但如今绝大多数全是64位构架,因而大家关键关心这些方面完成。编码中也有一大段注解,表述了什么叫 *** Value。认真阅读注解,后边大家将数次回望在其中內容。

//[...]

#elif USE( *** VALUE64)

/*

* On 64-bit platforms USE( *** VALUE64) should be defined, and we use a NaN-encoded

* form for immediates.

*

* The encoding makes use of unused NaN space in the IEEE754 representation. Any value

* with the top 13 bits set represents a QNaN (with the sign bit set). QNaN values

* can encode a 51-bit payload. Hardware produced and C-library payloads typically

* have a payload of zero. We assume that non-zero payloads are available to encode

* pointer and integer values. Since any 64-bit bit pattern where the top 15 bits are

* all set represents a NaN with a non-zero payload, we can use this space in the NaN

* ranges to encode other values (however there are also other ranges of NaN space that

* could have been selected).

*

* This range of NaN space is represented by 64-bit numbers begining with the 16-bit

* hex patterns 0xFFFE and 0xFFFF - we rely on the fact that no valid double-precision

* numbers will fall in these ranges.

*

* The top 16-bits denote the type of the encoded *** Value:

*

* Pointer{ 0000:PPPP:PPPP:PPPP

* / 0001:****:****:****

* Double{ ...

* FFFE:****:****:****

* Integer{ FFFF:0000:IIII:IIII

* *

* The scheme we have implemented encodes double precision values by performing a

* 64-bit integer addition of the value 2^48 to the number. After this manipulation

* no encoded double-precision value will begin with the pattern 0x0000 or 0xFFFF.

* Values must be decoded by reversing this operation before subsequent floating point

* operations may be peformed.

*

* 32-bit signed integers are marked with the 16-bit tag 0xFFFF.

*

* The tag 0x0000 denotes a pointer, or another form of tagged immediate. Boolean,

* null and undefined values are represented by specific, invalid pointer values:

*

* False: 0x06

* True: 0x07

相关文章

黑客情人节视频(黑客情人节视频大全)

黑客情人节视频(黑客情人节视频大全)

黑客可以通过电脑查看到手机发出来的视频吗? 视频监视是指看看你人喽,实质上有没有视频,黑客照样可以监视你的电脑。完全在他的掌握之中。你的手机被黑客攻击了:黑客可以通过网络攻击手段入侵你的手机,从而获取...

怎么查询在哪里开过房(怎么知道老婆和别人同个

9月11日消息,据网信江苏微信公众号8月份,江苏省网信系统按照国家网信办统一部署,统筹组织开展暑期“清朗行动”、网络直播行业、“自媒体”基础管理、商业网站平台账号等专项整治,强化多部门协作监管,集...

黑客追款成功被警察抓(黑客追款骗局)-网上被骗黑客帮忙

黑客追款成功被警察抓(黑客追款骗局)-网上被骗黑客帮忙

黑客追款成功被警察抓(黑客追款骗局)(tiechemo.com)一直致力于黑客(HACK)技术、黑客QQ群、信息安全、web安全、渗透运维、黑客工具、找黑客、黑客联系方式、24小时在线网络黑客、黑客业...

益母草颗粒(益母草催经吃几天)

益母草颗粒(益母草催经吃几天)

益母草颗粒(益母草催经吃几天)益母草是一种常见的中药材,对女性有条理经期的作用,那么益母草吃多久才有效果?益母草吃了多久来月经?益母草怎样吃效果最好?下面来看看! 一、益母草吃了多久来月经 很...

如何跟踪监视一个人(怎么监听一个人)

如何跟踪监视一个人(怎么监听一个人)

本文导读目录: 1、坏人会用什么手段跟踪监视别人? 2、苹果6手机怎么和朋友设置相互实时定位、就是任何时候我都能看到他的位置?求大神帮忙 3、怎样能通过石化的监控找到一个人 4、如果国家监...

元宵节的意义-元宵节的习俗

众所周知,米宵节是我国的一个非常重要的节日,每年米宵节都会有很多庆祝活动,大家也会尽量回家和家人团聚,米宵节的历史非常悠久,所以米宵节还是有很多习俗和特别的意义的,接下来大家就和小编一起了解一下米宵节...