Using frida framework, I'm trying to change const reference std::string to empty value.
I've pasted my code here.
var f_log_ptr = DebugSymbol.findFunctionsMatching("OurFunction*")[0];
console.log("Log_VA is at", f_log_ptr);
var myStringBuf = Memory.allocUtf8String('');
Interceptor.attach(f_log_ptr, {
onEnter: function (args) {
console.log("Invoked");
args[0] = myStringBuf;
},
onLeave: function (retval) {
}
});
After I'm doing this , this is causing a undefined behaviour and my application crashes at random locations. Could anyone please help how to modify const reference string?
My CPP function is here
myFunction(const std::string &path)
std::string s = "some non empty";
myFunction(s);
My frida version is : 12.4.8
If your function is this call then args0 is the this pointer. Perhaps you
want to modify args 1
On Fri, May 17, 2019, 8:47 AM AkhileshChaikam notifications@github.com
wrote:
Using frida framework, I'm trying to change const reference std::string to
empty value.I've pasted my code here.
var f_log_ptr = DebugSymbol.findFunctionsMatching("OurFunction*")[0];
console.log("Log_VA is at", f_log_ptr);var myStringBuf = Memory.allocUtf8String('');
Interceptor.attach(f_log_ptr, {
onEnter: function (args) {
console.log("Invoked");
args[0] = myStringBuf;
},onLeave: function (retval) {
}
});
After I'm doing this , this is causing a undefined behaviour and my
application crashes at random locations. Could anyone please help how to
modify const reference string?—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/frida/frida/issues/884?email_source=notifications&email_token=AASP42TINRX5TFDVOP3EO33PV2SMDA5CNFSM4HNU67I2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GUMUXTQ,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AASP42T3HP2XT6KQNCCWPA3PV2SMDANCNFSM4HNU67IQ
.
Additionally you're stuffing a char* into a std::string. They're not
interchangeable. If you want to replace a std::string then you have to
craft or create one.
On Fri, May 17, 2019, 9:39 AM Eugene Kolodenker ekolodenker@gmail.com
wrote:
If your function is this call then args0 is the this pointer. Perhaps you
want to modify args 1
- Sent from my iPhone 12SR.
On Fri, May 17, 2019, 8:47 AM AkhileshChaikam notifications@github.com
wrote:Using frida framework, I'm trying to change const reference std::string
to empty value.I've pasted my code here.
var f_log_ptr = DebugSymbol.findFunctionsMatching("OurFunction*")[0];
console.log("Log_VA is at", f_log_ptr);var myStringBuf = Memory.allocUtf8String('');
Interceptor.attach(f_log_ptr, {
onEnter: function (args) {
console.log("Invoked");
args[0] = myStringBuf;
},onLeave: function (retval) {
}
});
After I'm doing this , this is causing a undefined behaviour and my
application crashes at random locations. Could anyone please help how to
modify const reference string?—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/frida/frida/issues/884?email_source=notifications&email_token=AASP42TINRX5TFDVOP3EO33PV2SMDA5CNFSM4HNU67I2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GUMUXTQ,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AASP42T3HP2XT6KQNCCWPA3PV2SMDANCNFSM4HNU67IQ
.
Thanks @eugenekolo for your reply, how can I create a std::string with frida. I couldn't find anywhere?
Can someone please help me how to create std::string in this case?