Commit Graph

7 Commits

Author SHA1 Message Date
Ben Wagner ba15d41bdc Fix stack use after scope in FcConfigCompareValue
Discovered by AddressSanitizer. When left_o and right_o are promoted the
promoted values are placed on the stack in FcValuePromotionBuffer.
The FcValuePromotionBuffers must then continue to be in scope while
left_o and right_o point into their content. In 9d4e5d0f the
FcValuePromotionBuffers were moved into the incorrect scope, leaving
left_o and right_o pointing into an object whose lifetime has ended.
This is similar to left and right which appear to have a smaller scope
but are actually required to be in the larger scope.

Correct this by moving the FcValuePromotionBuffers to the proper scope.
Leave the left and right FcValues where they are since they are in the
correct scope already.

This also adds to test-conf the ability to create charset, langset,
range, and matrix in patterns. This allows for a simple test which fails
under AddressSanitizer before this change and passes after.
2021-02-16 11:30:32 -05:00
Ben Wagner 921ede9f46 Fix test-conf string to integer conversion.
The test-conf build_pattern attempted to convert known constant strings
into integer values. However, it did so by always converting the string
value to an integer if possible and then complaining if the key wasn't
of the expected type. This lead to error messages on "style": "Regular"
since "Regular" was recognized as "weight".

Instead, only attempt conversion from string to integer if the key is
the name of an object which can take an integer type. This eliminates
the spurious non-fatal errors reported when parsing
test-90-synthetic.json.

This also fixes an issue where the created value was given the type of
the object found, but the integer field was assigned. Instead, check
that the object type can take an integer and always set the value type
to integer.
2020-12-16 10:16:40 -05:00
Ben Wagner 5cd11d19df Fix wild frees and leak of fs in test-conf.
Reported by AddressSanitizer when running test-conf. The `query`,
`result`, and `result_fs` were not initialized to NULL so could result
in a wild free when first initialized.

The `method` was also not initialized to NULL so comparisons could be
made against random data if it had not yet been assigned.

The outer `fs` was never destroyed, but is also not used, so remove.
2020-12-14 12:34:21 -05:00
Akira TAGOH 23ab038281 Fix gcc warnings with -Wpointer-sign
Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/184
2019-11-06 20:28:58 +09:00
Akira TAGOH 9d3fb5b385 Fix make check fail on run-test-conf.sh 2019-04-03 12:02:09 +00:00
Akira TAGOH 71c9c7892a Add a test case for FcFontList 2018-11-27 09:39:15 +00:00
Akira TAGOH f665852df9 Add a testrunner for conf 2018-05-11 21:54:24 +09:00