MCPcopy Create free account
hub / github.com/Lil-House/Pyarmor-Static-Unpack-1shot / load

Method load

pycdc/pyc_string.cpp:19–49  ·  view source on GitHub ↗

PycString */

Source from the content-addressed store, hash-verified

17
18/* PycString */
19void PycString::load(PycData* stream, PycModule* mod)
20{
21 if (type() == TYPE_STRINGREF) {
22 PycRef<PycString> str = mod->getIntern(stream->get32());
23 m_type = str->m_type;
24 m_value = str->m_value;
25 } else {
26 int length;
27 if (type() == TYPE_SHORT_ASCII || type() == TYPE_SHORT_ASCII_INTERNED)
28 length = stream->getByte();
29 else
30 length = stream->get32();
31
32 if (length < 0)
33 throw std::bad_alloc();
34
35 m_value.resize(length);
36 if (length) {
37 stream->getBuffer(length, &m_value.front());
38 if (type() == TYPE_ASCII || type() == TYPE_ASCII_INTERNED ||
39 type() == TYPE_SHORT_ASCII || type() == TYPE_SHORT_ASCII_INTERNED) {
40 if (!check_ascii(m_value))
41 throw std::runtime_error("Invalid bytes in ASCII string");
42 }
43 }
44
45 if (type() == TYPE_INTERNED || type() == TYPE_ASCII_INTERNED ||
46 type() == TYPE_SHORT_ASCII_INTERNED)
47 mod->intern(this);
48 }
49}
50
51bool PycString::isEqual(PycRef<PycObject> obj) const
52{

Callers

nothing calls this directly

Calls 6

check_asciiFunction · 0.85
getInternMethod · 0.80
get32Method · 0.80
getByteMethod · 0.80
getBufferMethod · 0.80
internMethod · 0.80

Tested by

no test coverage detected