angr/procedures/java_jni/__init__.py
def _store_string_in_native_memory(self, string, addr=None):
        """
        Store given string UTF-8 encoded and zero terminated in native memory.

        :param str string:  String
        :param addr:        Native store address.
                            If not set, native memory is allocated.
        :return:            Native address of the string.
        """
        if addr is None:
            addr = self._allocate_native_memory(size=len(string)+1)
        else:
            # check if addr is symbolic
            if self.state.solver.symbolic(addr):
                l.error("Storing strings at symbolic addresses is not implemented. "
                        "Continue execution with concretized address.")
            addr = self.state.solver.eval(addr)

        # warn if string is symbolic
        if self.state.solver.symbolic(string):
            l.warning('Support for symbolic strings, passed to native code, is limited. '
                      'String will get concretized after `ReleaseStringUTFChars` is called.')

        # store chars one by one
        str_len = len(string) // 8
        for idx in range(str_len):
            str_byte = StrSubstr(idx, 1, string)
            self.state.memory.store(addr+idx, str_byte)

        # store terminating zero
        self.state.memory.store(len(string), BVV(0, 8))

        return addr

        Store given string UTF-8 encoded and zero terminated in native memory.

        :param str string:  String
        :param addr:        Native store address.
                            If not set, native memory is allocated.
        :return:            Native address of the string.
        
Store given string UTF-8 encoded and zero terminated in native memory.
Store given string UTF - 8 encoded and zero terminated in native memory .
def _store_string_in_native_memory(self, string, addr=None):
        if addr is None:
            addr = self._allocate_native_memory(size=len(string)+1)
        else:
            if self.state.solver.symbolic(addr):
                l.error("Storing strings at symbolic addresses is not implemented. "
                        "Continue execution with concretized address.")
            addr = self.state.solver.eval(addr)
        if self.state.solver.symbolic(string):
            l.warning('Support for symbolic strings, passed to native code, is limited. '
                      'String will get concretized after `ReleaseStringUTFChars` is called.')
        str_len = len(string) // 8
        for idx in range(str_len):
            str_byte = StrSubstr(idx, 1, string)
            self.state.memory.store(addr+idx, str_byte)
        self.state.memory.store(len(string), BVV(0, 8))
        return addr
def _store_string_in_native_memory ( self , string , addr = None ) : if addr is None : addr = self . _allocate_native_memory ( size = len ( string ) + 1 ) else : if self . state . solver . symbolic ( addr ) : l . error ( "Storing strings at symbolic addresses is not implemented. " "Continue execution with concretized address." ) addr = self . state . solver . eval ( addr ) if self . state . solver . symbolic ( string ) : l . warning ( 'Support for symbolic strings, passed to native code, is limited. ' 'String will get concretized after `ReleaseStringUTFChars` is called.' ) str_len = len ( string ) // 8 for idx in range ( str_len ) : str_byte = StrSubstr ( idx , 1 , string ) self . state . memory . store ( addr + idx , str_byte ) self . state . memory . store ( len ( string ) , BVV ( 0 , 8 ) ) return addr
Store given string UTF-8 encoded and zero terminated in native memory.
Store given string UTF - 8 encoded and zero terminated in native memory .
"""
        Store given string UTF-8 encoded and zero terminated in native memory.

        :param str string:  String
        :param addr:        Native store address.
                            If not set, native memory is allocated.
        :return:            Native address of the string.
        """ # check if addr is symbolic # warn if string is symbolic # store chars one by one # store terminating zero
Native address of the string.
Native address of the string .
self
string
None
addr
Native store address.
If not set, native memory is allocated.
Native store address . If not set native memory is allocated .