Screenshots illustrating the bug
On en.wikipedia.org [MediaWiki 1.23wmf8 (019de9e)]
Here's some screenshots which illustrate the issue better (also attached):
If an HTML-style comment <!-- like this --> appears in a ==Heading==, the "-->" may appear in the search results, as well as in search URLs.
Not a huge issue, but may point to underlying issues with the parsing of comments, and should probably be fixed.
Note the search link still went to the right page, but failed to find the heading due to the additional "--.3E" in the URL.