ganzhijie / libass

Automatically exported from code.google.com/p/libass
0 stars 0 forks source link

Section parsing is too strict #67

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I've hit a file in the wild which rendered at a very large font size--one 
sentence was taking up half the screen.  It looks like it's caused by this 
error in the file:

[Sc[Script Info]

This causes the whole section to be ignored, including PlayResX/PlayResY.  This 
file works in other players, despite the error; I think this should be 
tolerated.

I think VSFilter has the right approach: ignore section headers, and simply 
accept all keys all the time.  The only thing it does with section headers is 
record the latest style version.  Aside from that, section names have no effect 
on state, which makes parsing much more tolerant of errors.

Original issue reported on code.google.com by gl...@zewt.org on 18 Aug 2012 at 5:14

GoogleCodeExporter commented 9 years ago
>I think VSFilter has the right approach: ignore section headers, and simply 
accept all keys all the time.

I'm not sure about this at all. The ASS format is a mess, and somewhat correct 
basic syntax is about the least we should expect for correct operation. libass 
is already full of kludges and workarounds to deal with various VSFilter-isms 
or just plain broken subtitle files. I'd like to avoid adding more.

Original comment by g...@chown.ath.cx on 1 Oct 2012 at 2:49

GoogleCodeExporter commented 9 years ago
Software needs to deal with actual data, not idealized data.

Sections in this file format mean very little, since there's nearly no overlap 
in key names across sections.  If I remember correctly, the only overlap is 
Format:, and nobody implements that anyway.  (Format: should just be struck 
from the format and ignored, since nobody uses it--except to parrot the 
defaults--and nobody appears to implement it, and implementing it might well 
break files, since nobody's testing their files in parsers that do support it.)

You can pretty much treat SSA/ASS as if it's not a section-delimited format at 
all, treating section headers as data lines.  It's simpler, more 
error-tolerant, and gives parity with VSFilter.

Original comment by gl...@zewt.org on 1 Oct 2012 at 7:43

GoogleCodeExporter commented 9 years ago
I tried to look at it, but changing the section parsing this way seems to be 
really messy. Not sure if it's really worth doing for just one file?

Original comment by nfxjfg@googlemail.com on 3 Feb 2013 at 12:07