xmlparse_GetInputContext doesn't adjust the bounds of the substring it returns, leading to the python string result hanging off one or more ends of the buffer & associated nastiness. 2 line fix attached.
Logged In: YES user_id=21627 Thanks for the patch. This was just resubmitted as #1118602, which I have applied. Your patch also checks whether offset is negative; I believe this cannot happen. Committed as pyexpat.c 2.90 and 2.89.2.1 NEWS 1.1264 and 1.1193.2.31 Sorry this took so long; it would have caught my attention earlier if it was in the patches tracker, not the bugs tracker.