jsc decoding spy

First use 

JS_DecodeScript decompile bytecode bytes get jsc

 

reuse

size_t nchars;
if (!JS_DecodeBytes(cx, bytes, nbytes, nullptr, &nchars))
return nullptr;
jschar *chars = static_cast<jschar *>(JS_malloc(cx, nchars * sizeof(jschar)));
if (!chars)
return nullptr;
JS_ALWAYS_TRUE(JS_DecodeBytes(cx, bytes, nbytes, chars, &nchars));
 
Out of chars transcoding translated into utf-8 string is stored in the file
Finally free (chars); release the memory

Guess you like

Origin www.cnblogs.com/dzqdzq/p/10942510.html