]> granicus.if.org Git - libass/log
libass
6 years agoMakefile: silence warning when x86/utils has no symbols
Rodger Combs [Wed, 21 Jun 2017 04:16:22 +0000 (23:16 -0500)]
Makefile: silence warning when x86/utils has no symbols

6 years agox86: update x86inc.asm
Rodger Combs [Wed, 21 Jun 2017 04:15:31 +0000 (23:15 -0500)]
x86: update x86inc.asm

6 years agox86: asm adjustments for nasm compatibility
Rodger Combs [Wed, 21 Jun 2017 04:14:52 +0000 (23:14 -0500)]
x86: asm adjustments for nasm compatibility

6 years agoconfigure: cleanup in preparation for x86inc update and switch to nasm
Rodger Combs [Wed, 21 Jun 2017 04:10:34 +0000 (23:10 -0500)]
configure: cleanup in preparation for x86inc update and switch to nasm

6 years agorenderer: fix border existence check
Dr.Smile [Tue, 1 Aug 2017 18:35:59 +0000 (21:35 +0300)]
renderer: fix border existence check

Found by coverity scan.

6 years agostroker: add algorithm description
Dr.Smile [Tue, 1 Aug 2017 00:50:50 +0000 (03:50 +0300)]
stroker: add algorithm description

6 years agostroker: skip degenerate 2-point contours from broken fonts
Dr.Smile [Sat, 8 Apr 2017 18:15:48 +0000 (21:15 +0300)]
stroker: skip degenerate 2-point contours from broken fonts

6 years agocosmetic: fix codestyle
Dr.Smile [Sat, 8 Apr 2017 17:57:42 +0000 (20:57 +0300)]
cosmetic: fix codestyle

6 years agorenderer: fix handling of empty outlines
Dr.Smile [Sat, 8 Apr 2017 17:55:41 +0000 (20:55 +0300)]
renderer: fix handling of empty outlines

6 years agorenderer: switch to using two border outlines instead of one
Dr.Smile [Mon, 31 Jul 2017 03:27:09 +0000 (06:27 +0300)]
renderer: switch to using two border outlines instead of one

6 years agorenderer: remove legacy FreeType rasterizer
Dr.Smile [Thu, 13 Apr 2017 19:53:40 +0000 (22:53 +0300)]
renderer: remove legacy FreeType rasterizer

6 years agostroker: implement fast two-outline stroker
Dr.Smile [Mon, 31 Jul 2017 02:33:00 +0000 (05:33 +0300)]
stroker: implement fast two-outline stroker

6 years agorasterizer: implement simultaneous rasterization of two outlines
Dr.Smile [Mon, 31 Jul 2017 02:30:21 +0000 (05:30 +0300)]
rasterizer: implement simultaneous rasterization of two outlines

6 years agorasterizer: refactoring
Dr.Smile [Mon, 31 Jul 2017 02:33:59 +0000 (05:33 +0300)]
rasterizer: refactoring

6 years agocosmetic: extract most of the outline-related functions into separate file
Dr.Smile [Mon, 31 Jul 2017 02:15:13 +0000 (05:15 +0300)]
cosmetic: extract most of the outline-related functions into separate file

7 years agoRelease 0.13.7 0.13.7
Grigori Goronzy [Sat, 3 Jun 2017 17:07:46 +0000 (19:07 +0200)]
Release 0.13.7

7 years agoAllow using shadow offset to adjust size of text background
Ricardo Constantino [Wed, 26 Apr 2017 22:11:47 +0000 (23:11 +0100)]
Allow using shadow offset to adjust size of text background

Text background refers to the libass-only BorderStyle 4, which is
similar to 3, but isn't affected by outline/border size and doesn't
render shadow, so shadow offset can be used.

You can override the horizontal and vertical box size separately
with override tags, just like you can override the color with
shadow color.

Closes #270

7 years agoFix function prototype
Grigori Goronzy [Thu, 1 Jun 2017 12:04:03 +0000 (14:04 +0200)]
Fix function prototype

Not a serious issue: arguments were named/ordered incorrectly.
No functional change.

7 years agofontselect: cleanup lazy font index evaluation
Grigori Goronzy [Thu, 1 Jun 2017 12:01:15 +0000 (14:01 +0200)]
fontselect: cleanup lazy font index evaluation

Fixes a possible NULL pointer dereference, reported by Coverity.

7 years agodirectwrite: fix font collections dw-collections
Grigori Goronzy [Thu, 1 Jun 2017 09:25:09 +0000 (11:25 +0200)]
directwrite: fix font collections

DirectWrite's FontFileStream does not actually use the data of a specific
font in a collection, which was an expectation of the existing code. It
simply returns a stream to the underlying file, collection or not. So we
need to get the index of the font. This needs to be done lazily as this
information is only available in a FontFace, which is expensive to
initialize.

Add a new optional font provider function for lazy initialization of the
index and use it. This is similar to the check_postscript callback.

Fixes libass#275.

v2: fix type of returned value.

7 years agoFix PlayResX/Y calculations
Grigori Goronzy [Wed, 10 May 2017 11:39:57 +0000 (13:39 +0200)]
Fix PlayResX/Y calculations

Avoid that PlayResY is set to 0 when only PlayResX is specified and
set to 1. Setting PlayResY to 0 results in divide-by-zero errors.
Also fix PlayResX calculations in case only PlayResY is specified,
for completeness.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1474.

7 years agoChangelog: update
wm4 [Thu, 27 Apr 2017 12:49:25 +0000 (14:49 +0200)]
Changelog: update

7 years agoRemove arbitrary bitmap size limit large-bitmaps
Rodger Combs [Sun, 12 Feb 2017 01:19:31 +0000 (19:19 -0600)]
Remove arbitrary bitmap size limit

We're not aware of any specific reason for this number to be used,
and actual potentially-dangerous cases should be handled by the
other limits.

Fixes #260

7 years agoDon't limit size of "uuencoded" font lines
Oleg Oshmyan [Sat, 4 Feb 2017 14:09:36 +0000 (16:09 +0200)]
Don't limit size of "uuencoded" font lines

7 years agoFix decode_font when size % 4 != 0 or data contains illegal bytes
Oleg Oshmyan [Sat, 4 Feb 2017 02:02:50 +0000 (04:02 +0200)]
Fix decode_font when size % 4 != 0 or data contains illegal bytes

When given a byte c, decode_chars expects that 0 <= c - 33 <= 63,
i. e. that only the six lowest bits of c - 33 are possibly set.
With this assumption, it shifts and adds together multiple c - 33 values.

When c > 96, c - 33 has high nonzero bits, which interferes with other
shifted terms. c < 33 is even worse: c - 33 is negative (if unsigned char
fits in int), and left-shifting negative numbers has undefined behavior.
Even before the shift, on common platforms with a two's complement
representation of negative integers (or if unsigned char does not fit in
int and is promoted to unsigned int), c - 33 has high nonzero bits, which
again interfere with other shifted terms.

To make matters worse, even perfectly valid encoded data is affected when
size % 4 != 0, as decode_font calls decode_chars with '\0', which leads
decode_chars to shift and add -33, causing undefined behavior and/or
incorrect output.

Take our cue from VSFilter and bit-mask c - 33 to keep only the six
relevant bits. To ensure that we get the same bits as VSFilter when
c < 33 and to avoid the undefined behavior of left-shifting negative
numbers, convert the number to unsigned before masking and shifting.

While we are at it, rewrite decode_chars entirely
to get rid of any GPL code from mkvtoolnix.

Related mkvtoolnix bug: https://github.com/mbunkus/mkvtoolnix/issues/1003

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=516.

Also allocate exactly the right amount of memory for the font,
because why not.

7 years agoass_lazy_track_init: handle negative PlayResX/PlayResY
Oleg Oshmyan [Fri, 3 Feb 2017 23:53:43 +0000 (01:53 +0200)]
ass_lazy_track_init: handle negative PlayResX/PlayResY

Like VSFilter, treat negative values the same as missing values.

7 years agostring2timecode: don't truncate milliseconds to int
Oleg Oshmyan [Fri, 3 Feb 2017 19:40:19 +0000 (21:40 +0200)]
string2timecode: don't truncate milliseconds to int

Commit 8c8741fe2000d4b4d89a53f894363a42288cec3e attempted to fix this
expression and make it use the full range of long long, but it missed
the millisecond term.

This fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=522.
The entire timestamp can still overflow long long though.

7 years agoReuse numpad2align in parse_tag
Oleg Oshmyan [Fri, 3 Feb 2017 19:36:23 +0000 (21:36 +0200)]
Reuse numpad2align in parse_tag

7 years agoFix parsing of unusual Alignment values in ASS style definitions
Oleg Oshmyan [Fri, 3 Feb 2017 19:34:13 +0000 (21:34 +0200)]
Fix parsing of unusual Alignment values in ASS style definitions

Handle large and negative values except INT32_MIN like VSFilter.
This avoids both overflow and inconsistent internal state.

This fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=523.

VSFilter handles INT32_MIN like a mix of \an1, \an2 and \an3:

  * Vertical alignment is bottom.
  * Lines within the event are center-aligned.
  * Without \pos or \move, the center of the event is aligned
    with the right edge of the screen minus MarginR.
  * With \pos or \move, the left edge of the event is aligned
    with the position point.
  * Without \org, the rotation origin is aligned
    with the horizontal center of the event.
  * (With \org, the rotation origin is as specified.)

If we wanted to emulate this in libass, the cleanest way would be to
introduce a new horizontal alignment constant for this purpose that
would be used only for ASS style definitions with Alignment INT32_MIN.
This commit makes no attempt to do this and instead arbitrarily picks
\an2 for style definitions with Alignment -INT_MAX-1, which equals
INT32_MIN if int is int32_t. The fact that int is platform-dependent
is one of the reasons for this. We could change Alignment to be int32_t
instead of int for perfect VSFilter compatibility, but the same applies
to many other fields that currently use platform-dependent types.

7 years agoDon't treat :;<=>? as hexadecimal digits in color headers
Oleg Oshmyan [Fri, 3 Feb 2017 13:45:55 +0000 (15:45 +0200)]
Don't treat :;<=>? as hexadecimal digits in color headers

Oops.

7 years agoExplicitly handle FcPatternGetString(FC_POSTSCRIPT_NAME) mismatch
Oleg Oshmyan [Sat, 11 Feb 2017 12:02:32 +0000 (14:02 +0200)]
Explicitly handle FcPatternGetString(FC_POSTSCRIPT_NAME) mismatch

This does not affect functionality in any way,
but it hopefully makes the logic easier to follow.

Resolves CID 175691.

7 years agoTravis CI: remove HarfBuzz and re-remove Fontconfig from OS X builds
Oleg Oshmyan [Tue, 7 Feb 2017 12:14:07 +0000 (14:14 +0200)]
Travis CI: remove HarfBuzz and re-remove Fontconfig from OS X builds

Installing HarfBuzz through Homebrew seems to be consistently slow
whether we use the bottles and disable the Fontconfig cache or build
it from source and drop Fontconfig and other dependencies entirely.

To speed up OS X builds, disable both HarfBuzz and Fontconfig.
We build with HarfBuzz and Fontconfig on Linux, and we should
not have any platform-dependent code that depends on them,
so this should not reduce our code coverage.

7 years agoTravis CI: re-enable Fontconfig on OS X but force no cache built
Oleg Oshmyan [Mon, 6 Feb 2017 16:46:22 +0000 (18:46 +0200)]
Travis CI: re-enable Fontconfig on OS X but force no cache built

Building HarfBuzz from source works to avoid Fontconfig, but it is still
fairly slow. To further speed up the build, try to use only the prebuilt
bottle packages (which inevitably brings in Fontconfig as a dependency)
but hack the Fontconfig formula to avoid building the font cache.

Adding Fontconfig is not the goal of this commit, as we already have it
on Linux and our Fontconfig-related code "should" work equally well on
other platforms. But since we can now afford it, explicitly ask Homebrew
to install Fontconfig even if the dependency that brings it in disappears
from Homebrew in the future, and enjoy the improved code coverage.

7 years agoTravis CI: build with HarfBuzz
Oleg Oshmyan [Sun, 5 Feb 2017 18:47:48 +0000 (20:47 +0200)]
Travis CI: build with HarfBuzz

On OS X, disable some unnecessary HarfBuzz dependencies. This triggers
a source build of HarfBuzz, but it should be fast and avoids bringing
in Fontconfig through a dependency chain, which we want to avoid as it
wastes a lot of time building its cache when installed.

The dependency that brings in Fontconfig is gobject-introspection, but
we don't need icu4c either, so disable that to save a little more time
that would be spent installing icu4c. We could also disable glib, but
the fribidi formula also has it as a dependency and brings it in anyway.

7 years agoTravis CI: run Coverity Scan on every master build
Oleg Oshmyan [Sun, 5 Feb 2017 02:24:54 +0000 (04:24 +0200)]
Travis CI: run Coverity Scan on every master build

We never remember to push to the coverity_scan branch, so currently
Coverity Scan never runs. Our master builds are not very frequent,
so we should be able to afford running Coverity Scan on every build.

7 years agoTravis CI: build using both GCC and Clang
Oleg Oshmyan [Sun, 5 Feb 2017 02:21:58 +0000 (04:21 +0200)]
Travis CI: build using both GCC and Clang

On OS X, `gcc` is just an alias for Clang, so exclude it to
avoid wasting resources doing the exact same build job twice.

7 years agoTravis CI: remove libtool reinstall hack on OS X
Oleg Oshmyan [Sun, 5 Feb 2017 02:17:14 +0000 (04:17 +0200)]
Travis CI: remove libtool reinstall hack on OS X

The problem was fixed in Homebrew in libtool 2.4.6_1:
https://github.com/Homebrew/homebrew-core/commit/712f737a7f64f0fd905357c3765cdce0821a4af2

Since https://blog.travis-ci.com/2016-10-04-osx-73-default-image-live/,
this libtool comes preinstalled on Travis CI, thus the hack is no longer needed.

Homebrew bug report possibly relevant to the original problem:
https://github.com/Homebrew/legacy-homebrew/issues/43874

7 years agoTravis CI: explicitly install FreeType on Linux
Oleg Oshmyan [Sun, 5 Feb 2017 02:02:30 +0000 (04:02 +0200)]
Travis CI: explicitly install FreeType on Linux

Do this for consistency with the other library dependencies.

For reference, currently, both FreeType and Fontconfig
are preinstalled and don't need to be explicitly mentioned.

7 years agoTravis CI: don't require Fontconfig binaries
Oleg Oshmyan [Sun, 5 Feb 2017 01:44:34 +0000 (03:44 +0200)]
Travis CI: don't require Fontconfig binaries

Only the library is needed.

In fact, `apt-get install fontconfig` didn't even install the library at
all. Luckily, the package we actually want is preinstalled on Travis CI.
We could continue to rely on this fact and completely remove Fontconfig
from the install list, but it's clearer and possibly more future-proof
to explicitly list it there.

7 years agoTravis CI: disable Fontconfig on OS X
Oleg Oshmyan [Sun, 5 Feb 2017 00:05:20 +0000 (02:05 +0200)]
Travis CI: disable Fontconfig on OS X

Homebrew generates the Fontconfig cache when installing Fontconfig,
which delays the build by several minutes. Disable the Fontconfig
font provider on OS X to avoid this.

7 years agoReduce precision of border width in outline cache keys
Oleg Oshmyan [Mon, 30 Jan 2017 22:11:49 +0000 (00:11 +0200)]
Reduce precision of border width in outline cache keys

The value used to generate outline cache values is 26.6, so there
is no point in storing the more precise 16.16 in the cache key.
Indeed, this can only reduce the efficiency of the cache
and provide an extra opportunity for overflow.

7 years agoReflect border_scale in outline cache keys
Oleg Oshmyan [Mon, 30 Jan 2017 21:45:43 +0000 (23:45 +0200)]
Reflect border_scale in outline cache keys

border_scale can change, e. g. when ass_render_frame is called twice with
the same renderer but different tracks. Glyphs with equal \bord tag values
but different border_scale values produce different border outlines and
hence should be distinguished in outline cache keys. To this end, store
scaled border widths (which are really used when generating the outlines)
in cache keys instead of \bord tag values.

7 years agorender: remove redundant has_clips
Dr.Smile [Mon, 30 Jan 2017 23:47:58 +0000 (02:47 +0300)]
render: remove redundant has_clips

has_clips was a workaround for the case where a new image reused
the same memory address as another image used in the previous frame.
In case of such reuse, comparison by pointer address failed
to distinguish the different images in ass_detect_change().
After commit dd06ca30ea79ce50116a43cc5521d4eaf60a017e,
images in the previous frame are no longer freed before
the comparison with current frame. Thus no such reuse can occur,
and the workaround is redundant.

See https://github.com/libass/libass/pull/258.

7 years agorender_api: do not discard old images on reconfiguration fix-change-detection
wm4 [Fri, 13 Jan 2017 08:19:23 +0000 (09:19 +0100)]
render_api: do not discard old images on reconfiguration

I noticed that when resizing the mpv window while playback is ongoing
and with subtitles, that subtitles could sometimes get "stuck" on the
screen. The stuck subtitle would remain until the next subtitle event,
or until seeking to a position that has subtitles again.

It turned out that this was a libass change detection bug. The following
steps should reproduce the problem:

1. call ass_render_frame() with a time that has subtitles
2. call ass_set_frame_size() with a different size
3. call ass_render_frame() with a time that has no subtitles

The previous call will return with *detect_change==0.

To make this worse, libass will deallocate image data before the next
ass_render_frame() or ass_renderer_done(), which violates the API and
could possibly make some API users crash. (That the user can rely on
this is not documented though.)

There are two possible solutions:

1. Set a flag in ass_reconfigure(), that makes the next
   ass_render_frame() call always return *detect_change==2.
2. Do not discard the previous subtitles (images_root), so change
   detection can work reliably.

This commit implements 2. - I prefer this in part because it doesn't
clobber the previously returned image list before the next
ass_render_frame() call. (As pointed out above, this might be unexpected
behavior to the API user.)

This is a regression and was possibly broken by commit dd06ca and later.
I did not check whether it actually behaved sanely before that change,
but it probably did to a degree.

7 years agorender: clip BorderStyle=4 against screen
wm4 [Wed, 11 Jan 2017 06:10:13 +0000 (07:10 +0100)]
render: clip BorderStyle=4 against screen

ASS_Images returned by libass are guaranteed to be clipped. Not doing
this will cause invalid memory accesses in applications which try to use
this guarantee.

Fixes #254.

7 years agoBump ABI version and release 0.13.6 0.13.6
Oleg Oshmyan [Tue, 3 Jan 2017 19:20:20 +0000 (21:20 +0200)]
Bump ABI version and release 0.13.6

sizeof(ASS_Style) is actually part of the ABI, so adding the Justify field
in commit e54c123d5a08b6212533ddcced2cb1a50fa3d2b2 broke the ABI even
though we tried to avoid it by placing the field at the end of the struct.

7 years agoRelease 0.13.5 0.13.5
Oleg Oshmyan [Wed, 28 Dec 2016 23:52:10 +0000 (01:52 +0200)]
Release 0.13.5

7 years agoapi: make ass_set_cache_limits() work on total bitmap cache sizes
Dr.Smile [Wed, 28 Dec 2016 22:42:38 +0000 (01:42 +0300)]
api: make ass_set_cache_limits() work on total bitmap cache sizes

Previously was possible to set only bitmap_max_size,
now requested memory amount is divided between
bitmap_max_size and composite_max_size.

7 years agoFix memory leak when Language header is defined more than once
Oleg Oshmyan [Wed, 28 Dec 2016 20:19:51 +0000 (22:19 +0200)]
Fix memory leak when Language header is defined more than once

Discovered by OSS-Fuzz.
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=229.

7 years agoparse_tag: don't consume *end == ')' when called recursively
Oleg Oshmyan [Wed, 28 Dec 2016 19:45:01 +0000 (21:45 +0200)]
parse_tag: don't consume *end == ')' when called recursively

This did not cause any problems, but it's nicer
to guarantee that the return value is <= end.

7 years agoFix buffer overread in parse_tag when end points to a space
Oleg Oshmyan [Wed, 28 Dec 2016 19:14:21 +0000 (21:14 +0200)]
Fix buffer overread in parse_tag when end points to a space

When parse_tag is invoked recursively to handle the animated tags inside
a \t tag, the `end` argument is taken from the `end` field of a struct arg
in the enclosing parse_tag. When struct arg is filled by push_arg, this
field is always right-trimmed using rskip_spaces. Ultimately, the inner
parse_tag invokation sees its `end` argument point not to the ')' or '}'
of the \t as it expects but rather to the spaces preceding the ')' or '}'.

At this point, when parse_tag calls skip_spaces, which is ignorant of the
end pointer, it happily skips over the spaces preceding the ')', moving the
pointer past `end`. Subsequent `pointer != end` comparisons in parse_tag
fail (as in fact `pointer > end`), and parse_tag thinks it is still inside
the substring to be parsed.

This is harmless in many cases, but given either of the following inputs,
parse_tag reads past the end of the actual buffer that stores the string:

    {\t(\ }
    {\t(\ )(}

After this commit, parse_tag knows that `end` can point to a sequence of
spaces and avoids calling skip_spaces on `end`, thus avoiding the overread.

Discovered by OSS-Fuzz.
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=194.

7 years agodirectwrite: drop SAL annotations
Oleg Oshmyan [Wed, 7 Dec 2016 16:16:29 +0000 (18:16 +0200)]
directwrite: drop SAL annotations

MinGW and old versions of mingw-w64 don't define the SAL macros.
They don't serve any value to us, so just remove them from our code.

See https://github.com/libass/libass/pull/251.

7 years agoass_strtod: correctly convert large negative exponents
Oleg Oshmyan [Fri, 4 Nov 2016 14:27:44 +0000 (16:27 +0200)]
ass_strtod: correctly convert large negative exponents

Avoid overflow in dblExp that prevents subnormal numbers from being
generated (or small normal numbers if `double` supports many more
negative exponents than positive): if `10**abs(exp)` would overflow
and we actually want a negative exponent, switch to using precomputed
negative powers of 10 rather than positive.

Also avoid underflow for numbers with a large negative exponent where
the exponent alone underflows but the significand has enough digits to
cancel this out, e. g. in `10e-324` with IEEE 754 double.

7 years agoass_strtod: don't cast away const
Oleg Oshmyan [Sun, 30 Oct 2016 17:21:06 +0000 (19:21 +0200)]
ass_strtod: don't cast away const

7 years agoass_strtod: handle overflowing exponents
Oleg Oshmyan [Sun, 30 Oct 2016 14:36:14 +0000 (16:36 +0200)]
ass_strtod: handle overflowing exponents

The exponent may overflow an integer, e. g. in
`14e888888888888888888888888888880000000000000000000000000000`
on a 32-bit platform. Correctly handle this, including the case
when the exponent overflows but the whole string still describes
a valid floating-point number, e. g. in
`1[4294967200 zeros]e-4294967300`.

This fixes libass#244. Buffer overflow was fixed in 67f647e, and
this ensures that the string is converted to the correct number.

7 years agoass_strtod: skip leading zeros in mantissa
Oleg Oshmyan [Sun, 30 Oct 2016 00:26:00 +0000 (03:26 +0300)]
ass_strtod: skip leading zeros in mantissa

ass_strtod reads at most 18 leading digits of the mantissa.
This previously included zeros, even though they are not significant
digits, e. g. 0.000000000000000001e18 was converted to 0.0.
After this commit, leading zeros before and after the decimal point
will be skipped, so the above number will be correctly converted to 1.0.

7 years agoass_strtod: don't report overflow for 0.0e[huge exponent]
Oleg Oshmyan [Sat, 29 Oct 2016 23:57:24 +0000 (02:57 +0300)]
ass_strtod: don't report overflow for 0.0e[huge exponent]

7 years agoass_strtod: use size_t for substring lengths
Oleg Oshmyan [Sat, 29 Oct 2016 23:53:00 +0000 (02:53 +0300)]
ass_strtod: use size_t for substring lengths

This fixes overflow on extremely long input strings.
See libass#244.

7 years agoAdd text justification
Dan Oscarsson [Wed, 5 Oct 2016 11:52:47 +0000 (13:52 +0200)]
Add text justification

Subtitle recommendations often include that multi line
subtitles should be left justified as this is easier for
the eyes. This is also the standard used by several television
companies.

This add the possibility to define how subtitles are to
be justified, independently of where they are aligned.
The most common way could be to set justify to left, and have
alignment to center. But you can, for example, have alignment
to left and justify to center, giving subtitles to the left but
justifed on the center (instead of normal left justified).
Using justify right and alignment of center, might be good
choice for Arabic.

If justify is not defined, all works like before.
If justify is defined, subtitles are aligned as defined
by alignment and justified as defined by justify.

ASS is not extended by this, justify can only be defined
by setting Justify to wanted justification.

7 years agoAdd CVE identifiers of the fuzzing fixes.
Grigori Goronzy [Wed, 5 Oct 2016 09:10:04 +0000 (11:10 +0200)]
Add CVE identifiers of the fuzzing fixes.

As assigned by [1]. Unfortunately I only learned of the CVE assignments
after the release.

7 years agoRelease 0.13.4 0.13.4
Grigori Goronzy [Tue, 4 Oct 2016 23:10:25 +0000 (01:10 +0200)]
Release 0.13.4

7 years agoRemove unused variable
Grigori Goronzy [Tue, 4 Oct 2016 19:31:03 +0000 (21:31 +0200)]
Remove unused variable

7 years agoFix line wrapping mode 0/3 bugs
Grigori Goronzy [Tue, 4 Oct 2016 19:25:41 +0000 (21:25 +0200)]
Fix line wrapping mode 0/3 bugs

This fixes two separate bugs:

a) Don't move a linebreak into the first symbol. This results in a empty
   line at the front, which does not help to equalize line lengths at all.
   Instead, merge line with the second one.
b) When moving a linebreak into a symbol that already is a break, the
   number of lines must be decremented. Otherwise, uninitialized memory
   is possibly used for later layout operations.

Found by fuzzer test case
id:000085,sig:11,src:003377+003350,op:splice,rep:8.

This might also affect and hopefully fix libass#229.

v2: change semantics according to review

7 years agoFix blur coefficient calculation buffer overflow
Grigori Goronzy [Tue, 4 Oct 2016 00:47:36 +0000 (02:47 +0200)]
Fix blur coefficient calculation buffer overflow

Found by fuzzer test case id:000082,sig:11,src:002579,op:havoc,rep:8.
Correctness should be checked, but this fixes the overflow for good.

7 years agoFix memory leaks
Grigori Goronzy [Tue, 4 Oct 2016 00:41:45 +0000 (02:41 +0200)]
Fix memory leaks

Found by fuzzer test case id:000051,sig:11,sync:fuzzer3,src:004221.

7 years agoshaper: fix reallocation
Grigori Goronzy [Tue, 4 Oct 2016 00:35:26 +0000 (02:35 +0200)]
shaper: fix reallocation

Update the variable that tracks the allocated size. This potentially
improves performance and avoid some side effects, which lead to
undefined behavior in some cases.

Fixes fuzzer test case id:000051,sig:11,sync:fuzzer3,src:004221.

7 years agoCI: Don't fail on MacOS if brew cannot remove libtool.
torque [Sat, 24 Sep 2016 20:07:34 +0000 (13:07 -0700)]
CI: Don't fail on MacOS if brew cannot remove libtool.

This is the better option, as it won't break the CI script if travis
ends up removing the preinstalled libtool bundle for whatever reason.

7 years agoFix broken MacOS CI.
torque [Sat, 24 Sep 2016 19:50:51 +0000 (12:50 -0700)]
Fix broken MacOS CI.

At some point in the past Travis and homebrew colluded to break the
preinstalled libtool on travis MacOS instances. Forcing brew to
reinstall libtool seems to be the common solution that several other
projects on github have used.

7 years agoFix license title
Grigori Goronzy [Sat, 24 Sep 2016 19:20:42 +0000 (21:20 +0200)]
Fix license title

I'm a dummy. Of course it is the ISC license. I started to relicense
libass to ISC myself, after all.

7 years agoRelease 0.13.3 0.13.3
Grigori Goronzy [Sat, 24 Sep 2016 19:06:23 +0000 (21:06 +0200)]
Release 0.13.3

7 years agoImprove license file
Grigori Goronzy [Sat, 24 Sep 2016 18:52:40 +0000 (20:52 +0200)]
Improve license file

Fixes libass#234.

7 years agobitmap: use calloc instead of malloc/memset
Rodger Combs [Fri, 24 Jun 2016 04:39:06 +0000 (23:39 -0500)]
bitmap: use calloc instead of malloc/memset

This can improve perf somewhat with large bitmaps

7 years agocache: fix ownership tracking issues of ASS_Font
Dr.Smile [Sat, 16 Jul 2016 01:01:55 +0000 (04:01 +0300)]
cache: fix ownership tracking issues of ASS_Font

7 years agofont load from dir: use MSGL_INFO instead of MSGL_WARN
Avi Halachmi (:avih) [Sun, 10 Jul 2016 22:50:22 +0000 (01:50 +0300)]
font load from dir: use MSGL_INFO instead of MSGL_WARN

This is a normal course of action and should not generate a warning,
especially for applications which use libass and might notify the user
on such "warnings", while in fact it should be info or even verbose.

Fixes #231

7 years agorender: add refcounting functionality to image lists
Dr.Smile [Sun, 1 May 2016 19:29:35 +0000 (22:29 +0300)]
render: add refcounting functionality to image lists

7 years agocache: keep referenced cache values alive after ass_cache_empty()
Dr.Smile [Sun, 20 Sep 2015 23:57:42 +0000 (02:57 +0300)]
cache: keep referenced cache values alive after ass_cache_empty()

7 years agorender: keep track of any associated resources within ASS_Image
Dr.Smile [Sat, 19 Sep 2015 02:18:50 +0000 (05:18 +0300)]
render: keep track of any associated resources within ASS_Image

That resources can be cached composite bitmap or raw bitmap buffer.
Consequently, free lists are no longer needed.

7 years agocache: keep ref_count of all active objects nonzero
Dr.Smile [Sat, 19 Sep 2015 00:08:29 +0000 (03:08 +0300)]
cache: keep ref_count of all active objects nonzero

7 years agocache: replace size_func with parameter in ass_cache_commit()
Dr.Smile [Thu, 17 Sep 2015 22:15:16 +0000 (01:15 +0300)]
cache: replace size_func with parameter in ass_cache_commit()

7 years agocache: remove ass_cache_cancel(), cache failures instead
Dr.Smile [Thu, 17 Sep 2015 21:33:33 +0000 (00:33 +0300)]
cache: remove ass_cache_cancel(), cache failures instead

7 years agocache: switch to gradual cache clearing
Dr.Smile [Tue, 15 Sep 2015 17:18:17 +0000 (20:18 +0300)]
cache: switch to gradual cache clearing

Advantages over the old algorithm consist of the following.
 * There are no glitches due to full cache clearing.
   Items are arranged into linked list ordered by time of last use.
   Only the oldest items get deleted at the clearing event.
 * Each item now keeps track of number of references.
   Referenced cache values are immune to clearing.
 * Reduced amount of total cache memory for the same performance.
 * Reduced number of memory allocations per cache item.

7 years agoREADME: add QMPlay2 to list of projects using libass
Oleg Oshmyan [Fri, 17 Jun 2016 11:00:41 +0000 (14:00 +0300)]
README: add QMPlay2 to list of projects using libass

Closes #225.

7 years agoshaper: drop RTL base direction for RTL font encodings
Grigori Goronzy [Fri, 10 Jun 2016 11:35:28 +0000 (13:35 +0200)]
shaper: drop RTL base direction for RTL font encodings

VSFilter uses LTR base direction even if Arabic or Hebrew font
encodings are used, so do the same. This resolves some reordering
issues.

Fixes #224.

8 years agofont: fix NULL pointer dereference
Hannes Domani [Mon, 23 May 2016 17:04:32 +0000 (19:04 +0200)]
font: fix NULL pointer dereference

8 years agorasterizer: drop outlines with points at too large coordinates
Dr.Smile [Sat, 23 Apr 2016 16:44:05 +0000 (19:44 +0300)]
rasterizer: drop outlines with points at too large coordinates

Such points can overflow internal calculations and usually produced
as a result of NaN to integer conversion.

Should fix #210.

8 years agoMerge pull request #217 from ssbssa/master
Grigori Goronzy [Sun, 27 Mar 2016 14:04:11 +0000 (16:04 +0200)]
Merge pull request #217 from ssbssa/master

directwrite: fix leaks of IDWriteFontFamily/IDWriteFontCollection

8 years agodirectwrite: fix leaks of IDWriteFontFamily/IDWriteFontCollection
Hannes Domani [Sun, 27 Mar 2016 13:10:03 +0000 (15:10 +0200)]
directwrite: fix leaks of IDWriteFontFamily/IDWriteFontCollection

8 years agoconfigure: use proper quoting on iconv test
Sean McGovern [Sun, 13 Mar 2016 18:29:26 +0000 (14:29 -0400)]
configure: use proper quoting on iconv test

Unquoted strings cause an error when the test variable is empty.

8 years agoMerge pull request #214 from SeanMcG/upstream
Grigori Goronzy [Thu, 10 Mar 2016 09:48:18 +0000 (10:48 +0100)]
Merge pull request #214 from SeanMcG/upstream

Patches from VLC contrib collection

8 years agoconfigure: add libiconv only when it is both present and required
Sean McGovern [Thu, 10 Mar 2016 00:48:40 +0000 (19:48 -0500)]
configure: add libiconv only when it is both present and required

8 years agoconfigure: use correct ASFLAGS for yasm on Solaris
Sean McGovern [Thu, 10 Mar 2016 00:41:06 +0000 (19:41 -0500)]
configure: use correct ASFLAGS for yasm on Solaris

8 years agoconfigure.ac: add missing spaces to error message
wm4 [Wed, 9 Mar 2016 23:20:55 +0000 (00:20 +0100)]
configure.ac: add missing spaces to error message

8 years agoRelease 0.13.2 0.13.2
Oleg Oshmyan [Sat, 20 Feb 2016 19:33:37 +0000 (21:33 +0200)]
Release 0.13.2

8 years agoDocument default value for ass_set_check_readorder
Oleg Oshmyan [Sat, 20 Feb 2016 19:36:09 +0000 (21:36 +0200)]
Document default value for ass_set_check_readorder

8 years agoass: handle movement==0 in ass_step_sub()
wm4 [Thu, 4 Feb 2016 21:47:47 +0000 (22:47 +0100)]
ass: handle movement==0 in ass_step_sub()

Finds the start of the subtitle at "now".

8 years agofont: remove unused function
wm4 [Thu, 14 Jan 2016 13:18:35 +0000 (14:18 +0100)]
font: remove unused function

8 years agoass: add ass_set_check_readorder() API function
wm4 [Thu, 31 Dec 2015 16:26:46 +0000 (17:26 +0100)]
ass: add ass_set_check_readorder() API function

Not all API users will keep the event list on seeking. This also gives
the opportunity to API users to handle severely broken files with
duplicate ReadOrder entries. (It is not known whether this is really
needed, however VSFilter does not deduplicate using the ReadOrder
field.)

8 years agoass: declare mixing ass_flush_events() and ass_process_chunk() allowed
wm4 [Thu, 31 Dec 2015 15:28:00 +0000 (16:28 +0100)]
ass: declare mixing ass_flush_events() and ass_process_chunk() allowed

This was always the intention, but the wording could be read as if this
is not allowed. There was a bug that broke ass_flush_events() too, which
gives all the more reason to clarify this.

8 years agoChangelog: create entry for the next version
wm4 [Thu, 31 Dec 2015 15:23:44 +0000 (16:23 +0100)]
Changelog: create entry for the next version

It's always such a bother to write the changelog on release. And in
fact, there is no reason why the changelog should be written on release.
It's easier to edit it as we commit fixes or features.

I'm adding the changelog entries for the past two commits, and in the
future, we should add entries as we commit bug fixes or new features.

8 years agoass: reset the ReadOrder bitmap on ass_flush_events()
wm4 [Sun, 20 Dec 2015 09:08:28 +0000 (10:08 +0100)]
ass: reset the ReadOrder bitmap on ass_flush_events()

Otherwise, ass_process_chunk() will reject events that were previously
removed with ass_flush_events(), which is nonsense.