Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

frame.setlineno has serious flaws. #94438

Closed
Assignees
iritkatrielmarkshannonbrandtbucher
Labels
3.11only security fixes3.12only security fixestype-bugAn unexpected behavior, bug, or error
@markshannon

Description

@markshannon

Theframe_setlineno function works in in stages:

  • Determine a set of possible bytecode offsets as targets from the line number.
  • Compute the stack state for these targets and the current position
  • Determine a best target. That is, the first one that has a compatible stack.
  • Pop values form the stack and jump.

The first steps is faulty (I think, I haven't demonstrated this) as it might be possible to jump to an instruction involved in frame creation. This should be easy to fix using the new_co_firsttraceable field.

The second step has (at least) three flaws:

  • It does not account forNULLs on the stack, making it possible to jump from a stack withNULLs to one that cannot handleNULLs.
  • It does not skip over caches, so could produce incorrect stacks by misinterpreting cache entries as normal instructions.
  • It is out of date. For example it thinks thatPUSH_EXC_INFO pushes three values. It only pushes one.

Setting the line number of a frame is only possible in the debugger, so this isn't as terrible as might appear, but it definitely needs fixing.

Linked PRs

Metadata

Metadata

Labels

3.11only security fixes3.12only security fixestype-bugAn unexpected behavior, bug, or error

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp