[Python-Dev] Encoding of PyFrameObject members (original) (raw)
Armin Rigo arigo at tunes.org
Fri Feb 6 12:04:07 CET 2015
- Previous message: [Python-Dev] Encoding of PyFrameObject members
- Next message: [Python-Dev] Encoding of PyFrameObject members
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
On 6 February 2015 at 08:24, Maciej Fijalkowski <fijall at gmail.com> wrote:
I don't think it's safe to assume fcode is properly filled by the time you might read it, depending a bit where you find the frame object. Are you sure it's not full of garbage?
Yes, before discussing how to do the utf8 decoding, we should realize that it is really unsafe code starting from the line before. From a signal handler you're only supposed to read data that was written to "volatile" fields. So even PyEval_GetFrame(), which is done by reading the thread state's "frame" field, is not safe: this is not a volatile. This means that the compiler is free to do crazy things like first write into this field and then initialize the actual content of the frame. The uninitialized content may be garbage, not just NULLs.
A bientôt,
Armin.
- Previous message: [Python-Dev] Encoding of PyFrameObject members
- Next message: [Python-Dev] Encoding of PyFrameObject members
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]