Edgewall Software

Opened 17 years ago

Last modified 8 years ago

#151 new defect

Undefined behavor of extended iteration

Reported by: aronacher Owned by: cmlenz
Priority: major Milestone: 0.9
Component: General Version: 0.4.4
Keywords: Cc:

Description (last modified by cmlenz)

Right now for foo.bar, blub['blah'] in something is undefined in genshi (it does nothing, especially no error) and for foo['a in b'] in bar breaks with a syntax error although it's valid python.

Because of my work on the sandboxed branch it's important that iterations do not modify existing objects because they could be persistent, thus shared among renderings. A quickfix would be changing the in split to a regex like this:

r([A-Za-z_][A-Za-z0-9_]*(\s*,\s*[A-Za-z_][A-Za-z0-9_]*)*)\s+in

That would then automatically close the security problem of the sandbox branch too.

Change History (9)

comment:1 Changed 17 years ago by cmlenz

  • Description modified (diff)

(fixed formatting of description)

comment:2 Changed 17 years ago by Armin Ronacher

Here a regexp that supports nested tuples. Hackish because it also matches some invalid constructs but a user gets a parsing error later anyways:

r'([(A-Za-z_][A-Za-z0-9_)]*(\s*,\s*[(A-Za-z_][A-Za-z0-9_)]*)*)\s+in'

comment:3 Changed 16 years ago by cmlenz

  • Milestone changed from 0.5 to 0.5.1
  • Priority changed from blocker to major

Postponing.

comment:4 Changed 16 years ago by cmlenz

  • Milestone changed from 0.5.1 to 0.5.2

comment:5 Changed 16 years ago by anonymous

sddsdsdddsddds

comment:6 Changed 16 years ago by cmlenz

  • Milestone changed from 0.5.2 to 0.6

comment:7 Changed 15 years ago by cmlenz

  • Milestone changed from 0.6 to 0.6.1

comment:8 Changed 15 years ago by Carsten Klein <carsten.klein@…>

I would like to help fixing this issue, but I don't understand what the OP actually means.

Could you please provide a testcase or code fragment that exactly reproduces your issue in the context of say a template and an input document?

comment:9 Changed 8 years ago by hodgestar

  • Milestone changed from 0.6.1 to 0.9

Move to milestone 0.9.

Note: See TracTickets for help on using tickets.