2014: get_interesting_headers raises IndexError with C++ end-of-file whitespace change

timw.a******@gmai***** (Google Code) (Is this you? Claim this profile.)
March 21, 2011
What version are you running?
1.5.4

What's the URL of the page containing the problem?
http://example.com/r/4976/diff/

What steps will reproduce the problem?
1. Create a non-trivial (more than a few dozen lines) C++ source file with two newlines after the last function definition (revision 1)
2. Change the above file to add or remove newlines to the end of the file
3. Post a diff covering the change from step 2 to reviewboard
4. Attempt to view the diff (View Diff link)

What is the expected output? What do you see instead?
Expected: the diff viewer
Actual: IndexError in get_interesting_headers, where it accesses 'lines'

What operating system are you using? What browser?
Ubuntu. Any browser.

Please provide any additional information below.

I fixed the problem locally by wrapping 'if is_modified_file: / ... / else: / ...' with 'try: / ... / except IndexError: / raise StopIteration'.
(Sorry, I don't have a clean diff against 1.5.4 to post)

Based on the surrounding code and method names, the code in question is trying to get a context function name.

If your diff is trivial (only this file), the whole view-diff page refuses to load. If the diff is non-trivial, the asynchronous diff fetching will only fail for files with that type of change--however, it will prevent viewing any diff chunks for that file.
david
#1 david
Fixed in release-1.5.x as beda363. This will ship in 1.5.5. Thanks!
  • +Fixed