[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: regexp stack overflow
>>>>> In [emacs-w3m : No.08519] Silvio Neef wrote:
> Wow, it appears that TWiki is sending the entire page text as part of
> the URL when submitting changes to a page:
> Debugger entered--Lisp error: (error "Stack overflow in regexp matcher")
> string-match("\\`\\(\\([^:/?#]+\\):\\)?\\(//\\([^/?#]*\\)\\)?\\([^?#]*\\)\\(\\?\\([^#]*\\)\\)?\\(#\\(.*\\)\\)?\\'" "http://wiki/bin/preview/Main/BigWikiPage?text=---%2B%20Big%20Wiki%20Page%0D%0A%0D%0A [and so on, tens of kb of text ]
> w3m-expand-url("http://wiki/bin/preview/Main/BigWikiPage?text= [same here]
> w3m-fontify-anchors()
> w3m-fontify()
> w3m-create-text-page("http://wiki/bin/preview/Main/BigWikiPage" "text/html" "ISO-8859-1" #<buffer *w3m*>)
> ...
Oh, I see. I could reproduce the same error using Emacs 22.0.50
and:
(progn
(w3m-expand-url (concat "http://www.example.com/"
(make-string 66633 ?i)
"ndex.html"))
nil)
> so wherever W3M-URL-COMPONENTS-REGEXP is used I get in trouble. One
> could probably re-write this code so that it doesn't use a regexp.
Yes, I'm sure I can solve it in some way. I'll try it.
> However, maybe it's just a problem with my particular emacs version
> (21.2.1) or even the text I'm trying to match:
> http://lists.gnu.org/archive/html/emacs-pretest-bug/2004-11/msg00385.html
No, what have to be improved is emacs-w3m. Thank you for
digging it out.
> For now, I just added this nasty kludge, which works only for me of
> course:
> (defun w3m-expand-url (url &optional base)
> "Convert URL to the absolute address, and canonicalize it."
> (if (and (> (length url) 23)
> (string= (substring url 0 23)
> "http://wiki/bin/preview"))
> url
> (progn
> [ original function body goes here ]
> ))
;-)