mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-28 09:09:13 +01:00
Fix Coverity issues
This commit is contained in:
1 parent
3c94b1c061
commit
fbf3c1e218
4 files changed
+13
-6
No files matched your search
@@ -162,7 +162,7 @@ _hb_buffer_serialize_glyphs_json (hb_buffer_t *buffer,
|
||||
p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"cl\":%u", info[i].cluster));
|
||||
}
|
||||
|
||||
if (!(flags & HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS))
|
||||
if (pos && !(flags & HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS))
|
||||
{
|
||||
p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"dx\":%d,\"dy\":%d",
|
||||
x+pos[i].x_offset, y+pos[i].y_offset));
|
||||
@@ -319,7 +319,7 @@ _hb_buffer_serialize_glyphs_text (hb_buffer_t *buffer,
|
||||
p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "=%u", info[i].cluster));
|
||||
}
|
||||
|
||||
if (!(flags & HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS))
|
||||
if (pos && !(flags & HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS))
|
||||
{
|
||||
if (x+pos[i].x_offset || y+pos[i].y_offset)
|
||||
p += hb_max (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "@%d,%d", x+pos[i].x_offset, y+pos[i].y_offset));
|
||||
|
||||
@@ -1872,9 +1872,11 @@ struct cmap
|
||||
}
|
||||
else if (format == 14) c->copy (_, it, 14u, base, plan, &format14objidx);
|
||||
}
|
||||
c->check_assign(this->encodingRecord.len,
|
||||
(c->length () - cmap::min_size)/EncodingRecord::static_size,
|
||||
HB_SERIALIZE_ERROR_INT_OVERFLOW);
|
||||
unsigned length = c->length ();
|
||||
unsigned available = length > cmap::min_size ? length - cmap::min_size : 0;
|
||||
c->check_assign(this->encodingRecord.len,
|
||||
available / EncodingRecord::static_size,
|
||||
HB_SERIALIZE_ERROR_INT_OVERFLOW);
|
||||
|
||||
// Fail if format 4 was dropped and there is no cmap12.
|
||||
return !drop_format_4 || format12objidx;
|
||||
|
||||
@@ -167,6 +167,11 @@ hb_raster_svg_emit_fill (const hb_svg_fill_context_t *ctx,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!chain.length) {
|
||||
if (fallback_paint.len)
|
||||
hb_raster_svg_emit_fill (ctx, fallback_paint, fill_opacity, object_bbox, current_color);
|
||||
return;
|
||||
}
|
||||
hb_svg_gradient_t effective = *chain.arrayZ[chain.length - 1];
|
||||
for (int i = (int) chain.length - 2; i >= 0; i--)
|
||||
{
|
||||
|
||||
@@ -63,7 +63,7 @@ struct hb_svg_xml_parser_t
|
||||
bool self_closing;
|
||||
|
||||
hb_svg_xml_parser_t (const char *data, unsigned len)
|
||||
: p (data), end (data + len) {}
|
||||
: p (data), end (data + len), self_closing (false) {}
|
||||
|
||||
void skip_ws ()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user