Page MenuHomePhabricator

crashes when content of <source> is too long
Closed, ResolvedPublic

Description

Author: wonder

Description:
If there's a lot of source code in a <source> tag, the syntax highlighter crashes and the user gets a blank screen. It would be better to fall back to a plain <pre> block instead of syntax highlighting in that case, or something.


Version: unspecified
Severity: normal

Details

Reference
bz20656

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:51 PM
bzimport added a project: SyntaxHighlight.
bzimport set Reference to bz20656.
bzimport added a subscriber: Unknown Object (MLST).

Can you provide more details than just "blank page". Check the server logs or increase error reporting. If it is out of memory error I'm afraid there is nothing we can do. Which version of Geshi are you using?

wonder wrote:

MediaWiki 1.16alpha (i.e. trunk/phase3), at r56407, SyntaxHighlight_GeSHi Version 1.0.8.5 (r56284) according to Special:Version.

I see nothing relevant in the MW debug output.

I have in php.ini:
error_reporting = E_ALL & ~E_NOTICE

Anyway, there seems to be more than one way to crash it with oversize inputs.
On a Special: page that uses the source tag I see:
[Wed Sep 16 20:29:09 2009] [notice] child pid 25365 exit signal Segmentation fault (11)

and on a mainspace page that includes a source tag I see:
[Wed Sep 16 20:42:56 2009] [error] [client 127.0.0.1] PHP Fatal error: Allowed memory size of 52428800 bytes exhausted (tried to allocate 16 bytes) in /usr/src/mediawiki-extensions-trunk/SyntaxHighlight_GeSHi/geshi/geshi.php on line 3744

So at least some of the time it's an out of memory. I'm going to consider imposing a file size limit and just using <pre> for bigger ones.

Krinkle claimed this task.
Krinkle subscribed.

Fixed in rESHG6484894497f5: Highlight using Pygments rather than Geshi. We now enforce a limit of 100kb in size.