@troynt's Twitter Script

By Troy Thompson Last update Aug 6, 2010 — Installed 147,385 times.

Some short URL causes infinity loop

in
Subscribe to Some short URL causes infinity loop 2 posts, 2 voices



Higmmer User
FirefoxWindows

Hi, I've found that the URL expansion gets into infinity loop of calling LongUrlPlease API when it meets a certain kind of short URL in tweets, and it can cause browser freeze at the worst case.

Reproducible URLs are:
1. http://bit.ly/90ZgBP+
2. http://bit.ly/crossdomain.xml

The former URL is shrunk with bit.ly and added a analysis option "+". The LongUrlPlease API returns the following JSON response for this URL.

{"http:\/\/bit.ly\/90ZgBP ": null}

Function "expand_urls" cannot interpret the response because of two reasons:
- Short URL mismatch ("+" is replaced to " " at the end of URL)
- The long URL is set to null
As a result, the function goes into infinity loop and generates repeated API requests endlessly.

The latter URL is not shrunk but is a file on bit.ly itself. It also causes infinity loop after all. What's worse is that my Firefox gets unresponsive and frozen in this case.

As far as I can see, the solution might be:
- Remove additional options (such as "+") in the short URL
- Ignore invalid URL that doesn't seem to be shrunk
- Implement a limit count of calling API for each individual URL

Thank you for your great work and kind consideration.

 
Troy Thompson Script's Author
FirefoxWindows

Thanks for reporting this! Probably the most useful bug post ever.

I'll try to fix this soon.

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel