MantisBT - NetSurf
View Issue Details
0002129NetSurfAmiga-specificpublic2014-05-22 19:312014-06-04 18:19
ReporterChris Young 
Assigned ToMichael Drake 
PrioritynormalSeveritycrashReproducibilityalways
StatusconfirmedResolutionopen 
PlatformAmigaOSAmigaOSOS Version4.1
Product Version3.2 
Target VersionFixed in Version 
Fixed in CI build #
Reported in CI build #1900
URL of problem page
Summary0002129: Assert when selecting plain text
DescriptionI got the following assert when selecting some text in a plain text file:
assertion failed end<=text->utf8_data_size in render/textplain line 1218
Additional InformationI've had similar problems with text selection in the past, which only seems to occur on plain text files, not HTML.
TagsNo tags attached.
Attached Files

Notes
(0000354)
Vincent Sanders   
2014-05-29 11:45   
I had an extensive look at reproducing this and failed, though I did find and fix another bug (0002134) concerning line widths in text plain display.

This assert is actually caused because the plain text content handler "highlight the selected area" is being called with the end of the selected text beyond the number of characters in the buffer.

I have not yet been able to trace execution all the way back through to your front-end but I cannot reproduce the issue on gtk or framebuffer so I imagine this is something to do with disagreements over what index value the buffer ends at.

Could you add some debugging in render/textplain.c:1233 in textplain_coords_from_range() showing what the end value and text->utf8_data_size are when you reproduce the issue?

(0000360)
Chris Young   
2014-05-29 23:30   
In that file, highlighting from "box drawing alignment tests" to the end of the file causes the same assert.
(0000361)
Vincent Sanders   
2014-05-29 23:33   
ok, but it would be useful to know what the end value and text->utf8_data_size are as then we can tell it it is a simple off by 1 or if we are selecting completely out of bounds
(0000362)
Chris Young   
2014-05-30 19:01   
That was more a note for me, although once I'd added the debug it refused to crash in the same place.

I managed to get it to crash in a different file though:
end=1461256365, utf8_data_size=80112

The line above had end=165, so it looks like somehow end has got uninitialised?

Issue History
2014-05-22 19:31Chris YoungNew Issue
2014-05-24 21:19Vincent SandersAssigned To => Michael Drake
2014-05-24 21:19Vincent SandersReproducibilityhave not tried => always
2014-05-24 21:19Vincent SandersStatusnew => confirmed
2014-05-24 21:19Vincent SandersDescription Updatedbug_revision_view_page.php?rev_id=1233#r1233
2014-05-29 11:45Vincent SandersNote Added: 0000354
2014-05-29 11:45Vincent SandersAssigned ToMichael Drake => Chris Young
2014-05-29 11:45Vincent SandersCategoryLayout => Amiga-specific
2014-05-29 23:30Chris YoungNote Added: 0000360
2014-05-29 23:33Vincent SandersNote Added: 0000361
2014-05-30 19:01Chris YoungNote Added: 0000362
2014-06-04 18:19Chris YoungAssigned ToChris Young => Michael Drake
2014-06-04 18:19Chris YoungStatusconfirmed => assigned
2014-06-04 18:19Chris YoungStatusassigned => confirmed
2014-06-04 18:19Chris YoungDescription Updatedbug_revision_view_page.php?rev_id=1238#r1238