__system_property_read_callback(prop, ReadPropertyCallback, &data);
Pointers to C++ types are flying across module boundaries here.
Are we guaranteed to be using the same C++ library with the same std::string implementation as this function, or whatever stored this data?
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Commit-Queue | +1 |
__system_property_read_callback(prop, ReadPropertyCallback, &data);
Pointers to C++ types are flying across module boundaries here.
Are we guaranteed to be using the same C++ library with the same std::string implementation as this function, or whatever stored this data?
I made updates to not use std::string in the callback.
At first I didn't see the issue. Then I thought I did. Now I'm not so sure again.
The callback, called from libc.so, needed to call value->assign(). I thought this wasn't a problem because the |value| object would have a vtable pointer it uses to find the right assign() implementation. Then I thought I saw the problem was that dynamic dispatch implementation is not part of the C++ standard. However, ReadPropertyCallback() is compiled for this module so wouldn't it still use dynamic dispatch in the same way?
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
__system_property_read_callback(prop, ReadPropertyCallback, &data);
Joshua PerazaPointers to C++ types are flying across module boundaries here.
Are we guaranteed to be using the same C++ library with the same std::string implementation as this function, or whatever stored this data?
I made updates to not use std::string in the callback.
At first I didn't see the issue. Then I thought I did. Now I'm not so sure again.
The callback, called from libc.so, needed to call value->assign(). I thought this wasn't a problem because the |value| object would have a vtable pointer it uses to find the right assign() implementation. Then I thought I saw the problem was that dynamic dispatch implementation is not part of the C++ standard. However, ReadPropertyCallback() is compiled for this module so wouldn't it still use dynamic dispatch in the same way?
I made updates to not use std::string in the callback.
At first I didn't see the issue. Then I thought I did. Now I'm not so sure again.
Me neither.
I thought that the `string` itself was going to be used on the other side of a module boundary. But now I think that it’s not—you’re only passing a `string*` through the module boundary, but it’s not dereferenced to a `string` until it pops out of the other side, right into the `ReadPropertyCallback` function that’s in this module.
Now I think that patch set 3 is OK.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Commit-Queue | +1 |
__system_property_read_callback(prop, ReadPropertyCallback, &data);
Joshua PerazaPointers to C++ types are flying across module boundaries here.
Are we guaranteed to be using the same C++ library with the same std::string implementation as this function, or whatever stored this data?
Mark MentovaiI made updates to not use std::string in the callback.
At first I didn't see the issue. Then I thought I did. Now I'm not so sure again.
The callback, called from libc.so, needed to call value->assign(). I thought this wasn't a problem because the |value| object would have a vtable pointer it uses to find the right assign() implementation. Then I thought I saw the problem was that dynamic dispatch implementation is not part of the C++ standard. However, ReadPropertyCallback() is compiled for this module so wouldn't it still use dynamic dispatch in the same way?
I made updates to not use std::string in the callback.
At first I didn't see the issue. Then I thought I did. Now I'm not so sure again.
Me neither.
I thought that the `string` itself was going to be used on the other side of a module boundary. But now I think that it’s not—you’re only passing a `string*` through the module boundary, but it’s not dereferenced to a `string` until it pops out of the other side, right into the `ReadPropertyCallback` function that’s in this module.
Now I think that patch set 3 is OK.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Code-Review | +1 |
data->value->assign(value);
Bummed that the interface doesn’t make the length available, so you’re stuck feeling around in the dark for a NUL byte.
if (!data.read || value->empty()) {
Are we sure about this? A 0-length property value should still be valid.
In the past, it wasn’t possible to distinguish between a missing property and a 0-length value when calling `__system_property_get`: both cases return 0, so it’s reasonable to consider that return value as signaling an error. But now that this has been split into separate `__system_property_find` and `__system_property_read_callback` steps, we should be able to differentiate easily.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Commit-Queue | +2 |
Are we sure about this? A 0-length property value should still be valid.
In the past, it wasn’t possible to distinguish between a missing property and a 0-length value when calling `__system_property_get`: both cases return 0, so it’s reasonable to consider that return value as signaling an error. But now that this has been split into separate `__system_property_find` and `__system_property_read_callback` steps, we should be able to differentiate easily.
Yeah, an empty property value does look valid.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Code-Review | +1 |
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Migrate to __system_property_read_callback()
__system_property_get() is deprecated. __system_property_read_callback()
replaces it as of Android API level 26.
This change was generated using gemini-cli.
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |