project
stringclasses
633 values
commit_id
stringlengths
7
81
target
int64
0
1
func
stringlengths
5
484k
cwe
stringclasses
131 values
big_vul_idx
float64
0
189k
idx
int64
0
522k
hash
stringlengths
34
39
size
float64
1
24k
message
stringlengths
0
11.5k
dataset
stringclasses
1 value
savannah
8d22746c9e5af80ff4304aef440986403a5072e2
0
psh_hint_align( PSH_Hint hint, PSH_Globals globals, FT_Int dimension, PSH_Glyph glyph ) { PSH_Dimension dim = &globals->dimension[dimension]; FT_Fixed scale = dim->scale_mult; FT_Fixed delta = dim->scale_delta; if ( !psh_hint_is_fitted( hint ) ) { FT_Pos pos = FT_MulFix( hint->org_pos, scale ) + delta; FT_Pos len = FT_MulFix( hint->org_len, scale ); FT_Int do_snapping; FT_Pos fit_len; PSH_AlignmentRec align; /* ignore stem alignments when requested through the hint flags */ if ( ( dimension == 0 && !glyph->do_horz_hints ) || ( dimension == 1 && !glyph->do_vert_hints ) ) { hint->cur_pos = pos; hint->cur_len = len; psh_hint_set_fitted( hint ); return; } /* perform stem snapping when requested - this is necessary * for monochrome and LCD hinting modes only */ do_snapping = ( dimension == 0 && glyph->do_horz_snapping ) || ( dimension == 1 && glyph->do_vert_snapping ); hint->cur_len = fit_len = len; /* check blue zones for horizontal stems */ align.align = PSH_BLUE_ALIGN_NONE; align.align_bot = align.align_top = 0; if ( dimension == 1 ) psh_blues_snap_stem( &globals->blues, hint->org_pos + hint->org_len, hint->org_pos, &align ); switch ( align.align ) { case PSH_BLUE_ALIGN_TOP: /* the top of the stem is aligned against a blue zone */ hint->cur_pos = align.align_top - fit_len; break; case PSH_BLUE_ALIGN_BOT: /* the bottom of the stem is aligned against a blue zone */ hint->cur_pos = align.align_bot; break; case PSH_BLUE_ALIGN_TOP | PSH_BLUE_ALIGN_BOT: /* both edges of the stem are aligned against blue zones */ hint->cur_pos = align.align_bot; hint->cur_len = align.align_top - align.align_bot; break; default: { PSH_Hint parent = hint->parent; if ( parent ) { FT_Pos par_org_center, par_cur_center; FT_Pos cur_org_center, cur_delta; /* ensure that parent is already fitted */ if ( !psh_hint_is_fitted( parent ) ) psh_hint_align( parent, globals, dimension, glyph ); /* keep original relation between hints, this is, use the */ /* scaled distance between the centers of the hints to */ /* compute the new position */ par_org_center = parent->org_pos + ( parent->org_len >> 1 ); par_cur_center = parent->cur_pos + ( parent->cur_len >> 1 ); cur_org_center = hint->org_pos + ( hint->org_len >> 1 ); cur_delta = FT_MulFix( cur_org_center - par_org_center, scale ); pos = par_cur_center + cur_delta - ( len >> 1 ); } hint->cur_pos = pos; hint->cur_len = fit_len; /* Stem adjustment tries to snap stem widths to standard * ones. This is important to prevent unpleasant rounding * artefacts. */ if ( glyph->do_stem_adjust ) { if ( len <= 64 ) { /* the stem is less than one pixel; we will center it * around the nearest pixel center */ if ( len >= 32 ) { /* This is a special case where we also widen the stem * and align it to the pixel grid. * * stem_center = pos + (len/2) * nearest_pixel_center = FT_ROUND(stem_center-32)+32 * new_pos = nearest_pixel_center-32 * = FT_ROUND(stem_center-32) * = FT_FLOOR(stem_center-32+32) * = FT_FLOOR(stem_center) * new_len = 64 */ pos = FT_PIX_FLOOR( pos + ( len >> 1 ) ); len = 64; } else if ( len > 0 ) { /* This is a very small stem; we simply align it to the * pixel grid, trying to find the minimal displacement. * * left = pos * right = pos + len * left_nearest_edge = ROUND(pos) * right_nearest_edge = ROUND(right) * * if ( ABS(left_nearest_edge - left) <= * ABS(right_nearest_edge - right) ) * new_pos = left * else * new_pos = right */ FT_Pos left_nearest = FT_PIX_ROUND( pos ); FT_Pos right_nearest = FT_PIX_ROUND( pos + len ); FT_Pos left_disp = left_nearest - pos; FT_Pos right_disp = right_nearest - ( pos + len ); if ( left_disp < 0 ) left_disp = -left_disp; if ( right_disp < 0 ) right_disp = -right_disp; if ( left_disp <= right_disp ) pos = left_nearest; else pos = right_nearest; } else { /* this is a ghost stem; we simply round it */ pos = FT_PIX_ROUND( pos ); } } else { len = psh_dimension_quantize_len( dim, len, 0 ); } } /* now that we have a good hinted stem width, try to position */ /* the stem along a pixel grid integer coordinate */ hint->cur_pos = pos + psh_hint_snap_stem_side_delta( pos, len ); hint->cur_len = len; } } if ( do_snapping ) { pos = hint->cur_pos; len = hint->cur_len; if ( len < 64 ) len = 64; else len = FT_PIX_ROUND( len ); switch ( align.align ) { case PSH_BLUE_ALIGN_TOP: hint->cur_pos = align.align_top - len; hint->cur_len = len; break; case PSH_BLUE_ALIGN_BOT: hint->cur_len = len; break; case PSH_BLUE_ALIGN_BOT | PSH_BLUE_ALIGN_TOP: /* don't touch */ break; default: hint->cur_len = len; if ( len & 64 ) pos = FT_PIX_FLOOR( pos + ( len >> 1 ) ) + 32; else pos = FT_PIX_ROUND( pos + ( len >> 1 ) ); hint->cur_pos = pos - ( len >> 1 ); hint->cur_len = len; } } psh_hint_set_fitted( hint ); #ifdef DEBUG_HINTER if ( ps_debug_hint_func ) ps_debug_hint_func( hint, dimension ); #endif } }
CWE-399
10,336
17,008
224214725803532958585811587880724279737
null
null
null
savannah
8d22746c9e5af80ff4304aef440986403a5072e2
0
psh_hint_overlap( PSH_Hint hint1, PSH_Hint hint2 ) { return hint1->org_pos + hint1->org_len >= hint2->org_pos && hint2->org_pos + hint2->org_len >= hint1->org_pos; }
CWE-399
10,337
17,009
217232453891740434204817092699677289623
null
null
null
savannah
8d22746c9e5af80ff4304aef440986403a5072e2
0
psh_hint_snap_stem_side_delta( FT_Fixed pos, FT_Fixed len ) { FT_Fixed delta1 = FT_PIX_ROUND( pos ) - pos; FT_Fixed delta2 = FT_PIX_ROUND( pos + len ) - pos - len; if ( FT_ABS( delta1 ) <= FT_ABS( delta2 ) ) return delta1; else return delta2; }
CWE-399
10,338
17,010
226758394733355069849112825666144259002
null
null
null
savannah
8d22746c9e5af80ff4304aef440986403a5072e2
0
psh_hint_table_activate_mask( PSH_Hint_Table table, PS_Mask hint_mask ) { FT_Int mask = 0, val = 0; FT_Byte* cursor = hint_mask->bytes; FT_UInt idx, limit, count; limit = hint_mask->num_bits; count = 0; psh_hint_table_deactivate( table ); for ( idx = 0; idx < limit; idx++ ) { if ( mask == 0 ) { val = *cursor++; mask = 0x80; } if ( val & mask ) { PSH_Hint hint = &table->hints[idx]; if ( !psh_hint_is_active( hint ) ) { FT_UInt count2; #if 0 PSH_Hint* sort = table->sort; PSH_Hint hint2; for ( count2 = count; count2 > 0; count2--, sort++ ) { hint2 = sort[0]; if ( psh_hint_overlap( hint, hint2 ) ) FT_TRACE0(( "psh_hint_table_activate_mask:" " found overlapping hints\n" )) } #else count2 = 0; #endif if ( count2 == 0 ) { psh_hint_activate( hint ); if ( count < table->max_hints ) table->sort[count++] = hint; else FT_TRACE0(( "psh_hint_tableactivate_mask:" " too many active hints\n" )); } } } mask >>= 1; } table->num_hints = count; /* now, sort the hints; they are guaranteed to not overlap */ /* so we can compare their "org_pos" field directly */ { FT_Int i1, i2; PSH_Hint hint1, hint2; PSH_Hint* sort = table->sort; /* a simple bubble sort will do, since in 99% of cases, the hints */ /* will be already sorted -- and the sort will be linear */ for ( i1 = 1; i1 < (FT_Int)count; i1++ ) { hint1 = sort[i1]; for ( i2 = i1 - 1; i2 >= 0; i2-- ) { hint2 = sort[i2]; if ( hint2->org_pos < hint1->org_pos ) break; sort[i2 + 1] = hint2; sort[i2] = hint1; } } } }
CWE-399
10,339
17,011
93289699794305571533247546619436356640
null
null
null
savannah
8d22746c9e5af80ff4304aef440986403a5072e2
0
psh_hint_table_align_hints( PSH_Hint_Table table, PSH_Globals globals, FT_Int dimension, PSH_Glyph glyph ) { PSH_Hint hint; FT_UInt count; #ifdef DEBUG_HINTER PSH_Dimension dim = &globals->dimension[dimension]; FT_Fixed scale = dim->scale_mult; FT_Fixed delta = dim->scale_delta; if ( ps_debug_no_vert_hints && dimension == 0 ) { ps_simple_scale( table, scale, delta, dimension ); return; } if ( ps_debug_no_horz_hints && dimension == 1 ) { ps_simple_scale( table, scale, delta, dimension ); return; } #endif /* DEBUG_HINTER*/ hint = table->hints; count = table->max_hints; for ( ; count > 0; count--, hint++ ) psh_hint_align( hint, globals, dimension, glyph ); }
CWE-399
10,340
17,012
25670648388086276142763466281118216567
null
null
null
savannah
8d22746c9e5af80ff4304aef440986403a5072e2
0
psh_hint_table_deactivate( PSH_Hint_Table table ) { FT_UInt count = table->max_hints; PSH_Hint hint = table->hints; for ( ; count > 0; count--, hint++ ) { psh_hint_deactivate( hint ); hint->order = -1; } }
CWE-399
10,341
17,013
83170839105341569940765900080930387929
null
null
null
savannah
8d22746c9e5af80ff4304aef440986403a5072e2
0
psh_hint_table_done( PSH_Hint_Table table, FT_Memory memory ) { FT_FREE( table->zones ); table->num_zones = 0; table->zone = 0; FT_FREE( table->sort ); FT_FREE( table->hints ); table->num_hints = 0; table->max_hints = 0; table->sort_global = 0; }
CWE-399
10,342
17,014
203557851721579038921346810551377144299
null
null
null
savannah
8d22746c9e5af80ff4304aef440986403a5072e2
0
psh_hint_table_find_strong_points( PSH_Hint_Table table, PSH_Point point, FT_UInt count, FT_Int threshold, FT_Int major_dir ) { PSH_Hint* sort = table->sort; FT_UInt num_hints = table->num_hints; for ( ; count > 0; count--, point++ ) { FT_Int point_dir = 0; FT_Pos org_u = point->org_u; if ( psh_point_is_strong( point ) ) continue; if ( PSH_DIR_COMPARE( point->dir_in, major_dir ) ) point_dir = point->dir_in; else if ( PSH_DIR_COMPARE( point->dir_out, major_dir ) ) point_dir = point->dir_out; if ( point_dir ) { if ( point_dir == major_dir ) { FT_UInt nn; for ( nn = 0; nn < num_hints; nn++ ) { PSH_Hint hint = sort[nn]; FT_Pos d = org_u - hint->org_pos; if ( d < threshold && -d < threshold ) { psh_point_set_strong( point ); point->flags2 |= PSH_POINT_EDGE_MIN; point->hint = hint; break; } } } else if ( point_dir == -major_dir ) { FT_UInt nn; for ( nn = 0; nn < num_hints; nn++ ) { PSH_Hint hint = sort[nn]; FT_Pos d = org_u - hint->org_pos - hint->org_len; if ( d < threshold && -d < threshold ) { psh_point_set_strong( point ); point->flags2 |= PSH_POINT_EDGE_MAX; point->hint = hint; break; } } } } #if 1 else if ( psh_point_is_extremum( point ) ) { /* treat extrema as special cases for stem edge alignment */ FT_UInt nn, min_flag, max_flag; if ( major_dir == PSH_DIR_HORIZONTAL ) { min_flag = PSH_POINT_POSITIVE; max_flag = PSH_POINT_NEGATIVE; } else { min_flag = PSH_POINT_NEGATIVE; max_flag = PSH_POINT_POSITIVE; } if ( point->flags2 & min_flag ) { for ( nn = 0; nn < num_hints; nn++ ) { PSH_Hint hint = sort[nn]; FT_Pos d = org_u - hint->org_pos; if ( d < threshold && -d < threshold ) { point->flags2 |= PSH_POINT_EDGE_MIN; point->hint = hint; psh_point_set_strong( point ); break; } } } else if ( point->flags2 & max_flag ) { for ( nn = 0; nn < num_hints; nn++ ) { PSH_Hint hint = sort[nn]; FT_Pos d = org_u - hint->org_pos - hint->org_len; if ( d < threshold && -d < threshold ) { point->flags2 |= PSH_POINT_EDGE_MAX; point->hint = hint; psh_point_set_strong( point ); break; } } } if ( point->hint == NULL ) { for ( nn = 0; nn < num_hints; nn++ ) { PSH_Hint hint = sort[nn]; if ( org_u >= hint->org_pos && org_u <= hint->org_pos + hint->org_len ) { point->hint = hint; break; } } } } #endif /* 1 */ } }
CWE-399
10,343
17,015
236161005076674867018023700376468596779
null
null
null
savannah
8d22746c9e5af80ff4304aef440986403a5072e2
0
psh_hint_table_record( PSH_Hint_Table table, FT_UInt idx ) { PSH_Hint hint = table->hints + idx; if ( idx >= table->max_hints ) { FT_TRACE0(( "psh_hint_table_record: invalid hint index %d\n", idx )); return; } /* ignore active hints */ if ( psh_hint_is_active( hint ) ) return; psh_hint_activate( hint ); /* now scan the current active hint set to check */ /* whether `hint' overlaps with another hint */ { PSH_Hint* sorted = table->sort_global; FT_UInt count = table->num_hints; PSH_Hint hint2; hint->parent = 0; for ( ; count > 0; count--, sorted++ ) { hint2 = sorted[0]; if ( psh_hint_overlap( hint, hint2 ) ) { hint->parent = hint2; break; } } } if ( table->num_hints < table->max_hints ) table->sort_global[table->num_hints++] = hint; else FT_TRACE0(( "psh_hint_table_record: too many sorted hints! BUG!\n" )); }
CWE-399
10,345
17,016
299796023726159418963423079770517935872
null
null
null
savannah
8d22746c9e5af80ff4304aef440986403a5072e2
0
psh_hint_table_record_mask( PSH_Hint_Table table, PS_Mask hint_mask ) { FT_Int mask = 0, val = 0; FT_Byte* cursor = hint_mask->bytes; FT_UInt idx, limit; limit = hint_mask->num_bits; for ( idx = 0; idx < limit; idx++ ) { if ( mask == 0 ) { val = *cursor++; mask = 0x80; } if ( val & mask ) psh_hint_table_record( table, idx ); mask >>= 1; } }
CWE-399
10,346
17,017
159511926484119083700858818942460548859
null
null
null
savannah
8d22746c9e5af80ff4304aef440986403a5072e2
0
psh_print_zone( PSH_Zone zone ) { printf( "zone [scale,delta,min,max] = [%.3f,%.3f,%d,%d]\n", zone->scale / 65536.0, zone->delta / 64.0, zone->min, zone->max ); }
CWE-399
10,347
17,018
10172764203203610823909202893857352367
null
null
null
savannah
7d3d2cc4fef72c6be9c454b3809c387e12b44cfc
0
cff_builder_add_contour( CFF_Builder* builder ) { FT_Outline* outline = builder->current; FT_Error error; if ( !builder->load_points ) { outline->n_contours++; return CFF_Err_Ok; } error = FT_GLYPHLOADER_CHECK_POINTS( builder->loader, 0, 1 ); if ( !error ) { if ( outline->n_contours > 0 ) outline->contours[outline->n_contours - 1] = (short)( outline->n_points - 1 ); outline->n_contours++; } return error; }
CWE-189
10,348
17,019
86122796811552277797789808341700254562
null
null
null
savannah
7d3d2cc4fef72c6be9c454b3809c387e12b44cfc
0
cff_builder_add_point( CFF_Builder* builder, FT_Pos x, FT_Pos y, FT_Byte flag ) { FT_Outline* outline = builder->current; if ( builder->load_points ) { FT_Vector* point = outline->points + outline->n_points; FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points; point->x = x >> 16; point->y = y >> 16; *control = (FT_Byte)( flag ? FT_CURVE_TAG_ON : FT_CURVE_TAG_CUBIC ); } outline->n_points++; }
CWE-189
10,349
17,020
172059495146520949728250165025887990634
null
null
null
savannah
7d3d2cc4fef72c6be9c454b3809c387e12b44cfc
0
cff_builder_add_point1( CFF_Builder* builder, FT_Pos x, FT_Pos y ) { FT_Error error; error = check_points( builder, 1 ); if ( !error ) cff_builder_add_point( builder, x, y, 1 ); return error; }
CWE-189
10,350
17,021
111681918768883571259224744311094011254
null
null
null
savannah
7d3d2cc4fef72c6be9c454b3809c387e12b44cfc
0
cff_builder_close_contour( CFF_Builder* builder ) { FT_Outline* outline = builder->current; FT_Int first; if ( !outline ) return; first = outline->n_contours <= 1 ? 0 : outline->contours[outline->n_contours - 2] + 1; /* We must not include the last point in the path if it */ /* is located on the first point. */ if ( outline->n_points > 1 ) { FT_Vector* p1 = outline->points + first; FT_Vector* p2 = outline->points + outline->n_points - 1; FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1; /* `delete' last point only if it coincides with the first */ /* point and if it is not a control point (which can happen). */ if ( p1->x == p2->x && p1->y == p2->y ) if ( *control == FT_CURVE_TAG_ON ) outline->n_points--; } if ( outline->n_contours > 0 ) { /* Don't add contours only consisting of one point, i.e., */ /* check whether begin point and last point are the same. */ if ( first == outline->n_points - 1 ) { outline->n_contours--; outline->n_points--; } else outline->contours[outline->n_contours - 1] = (short)( outline->n_points - 1 ); } }
CWE-189
10,351
17,022
216111474953731081086559325435473118065
null
null
null
savannah
7d3d2cc4fef72c6be9c454b3809c387e12b44cfc
0
cff_builder_done( CFF_Builder* builder ) { CFF_GlyphSlot glyph = builder->glyph; if ( glyph ) glyph->root.outline = *builder->base; }
CWE-189
10,352
17,023
96796212637590504957080250330186014023
null
null
null
savannah
7d3d2cc4fef72c6be9c454b3809c387e12b44cfc
0
cff_builder_init( CFF_Builder* builder, TT_Face face, CFF_Size size, CFF_GlyphSlot glyph, FT_Bool hinting ) { builder->path_begun = 0; builder->load_points = 1; builder->face = face; builder->glyph = glyph; builder->memory = face->root.memory; if ( glyph ) { FT_GlyphLoader loader = glyph->root.internal->loader; builder->loader = loader; builder->base = &loader->base.outline; builder->current = &loader->current.outline; FT_GlyphLoader_Rewind( loader ); builder->hints_globals = 0; builder->hints_funcs = 0; if ( hinting && size ) { CFF_Internal internal = (CFF_Internal)size->root.internal; builder->hints_globals = (void *)internal->topfont; builder->hints_funcs = glyph->root.internal->glyph_hints; } } builder->pos_x = 0; builder->pos_y = 0; builder->left_bearing.x = 0; builder->left_bearing.y = 0; builder->advance.x = 0; builder->advance.y = 0; }
CWE-189
10,353
17,024
243998561064285459176838470612012753189
null
null
null
savannah
7d3d2cc4fef72c6be9c454b3809c387e12b44cfc
0
cff_builder_start_point( CFF_Builder* builder, FT_Pos x, FT_Pos y ) { FT_Error error = CFF_Err_Ok; /* test whether we are building a new contour */ if ( !builder->path_begun ) { builder->path_begun = 1; error = cff_builder_add_contour( builder ); if ( !error ) error = cff_builder_add_point1( builder, x, y ); } return error; }
CWE-189
10,354
17,025
668030528229028832924772977177273956
null
null
null
savannah
7d3d2cc4fef72c6be9c454b3809c387e12b44cfc
0
cff_compute_bias( FT_Int in_charstring_type, FT_UInt num_subrs ) { FT_Int result; if ( in_charstring_type == 1 ) result = 0; else if ( num_subrs < 1240 ) result = 107; else if ( num_subrs < 33900U ) result = 1131; else result = 32768U; return result; }
CWE-189
10,355
17,026
162423365259864389450708287177814866481
null
null
null
savannah
7d3d2cc4fef72c6be9c454b3809c387e12b44cfc
0
cff_decoder_prepare( CFF_Decoder* decoder, CFF_Size size, FT_UInt glyph_index ) { CFF_Builder *builder = &decoder->builder; CFF_Font cff = (CFF_Font)builder->face->extra.data; CFF_SubFont sub = &cff->top_font; FT_Error error = CFF_Err_Ok; /* manage CID fonts */ if ( cff->num_subfonts ) { FT_Byte fd_index = cff_fd_select_get( &cff->fd_select, glyph_index ); if ( fd_index >= cff->num_subfonts ) { FT_TRACE4(( "cff_decoder_prepare: invalid CID subfont index\n" )); error = CFF_Err_Invalid_File_Format; goto Exit; } FT_TRACE4(( "glyph index %d (subfont %d):\n", glyph_index, fd_index )); sub = cff->subfonts[fd_index]; if ( builder->hints_funcs && size ) { CFF_Internal internal = (CFF_Internal)size->root.internal; /* for CFFs without subfonts, this value has already been set */ builder->hints_globals = (void *)internal->subfonts[fd_index]; } } #ifdef FT_DEBUG_LEVEL_TRACE else FT_TRACE4(( "glyph index %d:\n", glyph_index )); #endif decoder->num_locals = sub->local_subrs_index.count; decoder->locals = sub->local_subrs; decoder->locals_bias = cff_compute_bias( decoder->cff->top_font.font_dict.charstring_type, decoder->num_locals ); decoder->glyph_width = sub->private_dict.default_width; decoder->nominal_width = sub->private_dict.nominal_width; Exit: return error; }
CWE-189
10,357
17,027
306434164063022820356215042540801475995
null
null
null
savannah
7d3d2cc4fef72c6be9c454b3809c387e12b44cfc
0
cff_free_glyph_data( TT_Face face, FT_Byte** pointer, FT_ULong length ) { #ifndef FT_CONFIG_OPTION_INCREMENTAL FT_UNUSED( length ); #endif #ifdef FT_CONFIG_OPTION_INCREMENTAL /* For incremental fonts get the character data using the */ /* callback function. */ if ( face->root.internal->incremental_interface ) { FT_Data data; data.pointer = *pointer; data.length = length; face->root.internal->incremental_interface->funcs->free_glyph_data( face->root.internal->incremental_interface->object, &data ); } else #endif /* FT_CONFIG_OPTION_INCREMENTAL */ { CFF_Font cff = (CFF_Font)(face->extra.data); cff_index_forget_element( &cff->charstrings_index, pointer ); } }
CWE-189
10,358
17,028
215424735230197525356765023960397345858
null
null
null
savannah
7d3d2cc4fef72c6be9c454b3809c387e12b44cfc
0
cff_get_glyph_data( TT_Face face, FT_UInt glyph_index, FT_Byte** pointer, FT_ULong* length ) { #ifdef FT_CONFIG_OPTION_INCREMENTAL /* For incremental fonts get the character data using the */ /* callback function. */ if ( face->root.internal->incremental_interface ) { FT_Data data; FT_Error error = face->root.internal->incremental_interface->funcs->get_glyph_data( face->root.internal->incremental_interface->object, glyph_index, &data ); *pointer = (FT_Byte*)data.pointer; *length = data.length; return error; } else #endif /* FT_CONFIG_OPTION_INCREMENTAL */ { CFF_Font cff = (CFF_Font)(face->extra.data); return cff_index_access_element( &cff->charstrings_index, glyph_index, pointer, length ); } }
CWE-189
10,359
17,029
313841421661471911740252611402823445768
null
null
null
savannah
7d3d2cc4fef72c6be9c454b3809c387e12b44cfc
0
cff_lookup_glyph_by_stdcharcode( CFF_Font cff, FT_Int charcode ) { FT_UInt n; FT_UShort glyph_sid; /* CID-keyed fonts don't have glyph names */ if ( !cff->charset.sids ) return -1; /* check range of standard char code */ if ( charcode < 0 || charcode > 255 ) return -1; /* Get code to SID mapping from `cff_standard_encoding'. */ glyph_sid = cff_get_standard_encoding( (FT_UInt)charcode ); for ( n = 0; n < cff->num_glyphs; n++ ) { if ( cff->charset.sids[n] == glyph_sid ) return n; } return -1; }
CWE-189
10,360
17,030
176142144256922282654669571096679346785
null
null
null
savannah
7d3d2cc4fef72c6be9c454b3809c387e12b44cfc
0
cff_operator_seac( CFF_Decoder* decoder, FT_Pos asb, FT_Pos adx, FT_Pos ady, FT_Int bchar, FT_Int achar ) { FT_Error error; CFF_Builder* builder = &decoder->builder; FT_Int bchar_index, achar_index; TT_Face face = decoder->builder.face; FT_Vector left_bearing, advance; FT_Byte* charstring; FT_ULong charstring_len; FT_Pos glyph_width; if ( decoder->seac ) { FT_ERROR(( "cff_operator_seac: invalid nested seac\n" )); return CFF_Err_Syntax_Error; } adx += decoder->builder.left_bearing.x; ady += decoder->builder.left_bearing.y; #ifdef FT_CONFIG_OPTION_INCREMENTAL /* Incremental fonts don't necessarily have valid charsets. */ /* They use the character code, not the glyph index, in this case. */ if ( face->root.internal->incremental_interface ) { bchar_index = bchar; achar_index = achar; } else #endif /* FT_CONFIG_OPTION_INCREMENTAL */ { CFF_Font cff = (CFF_Font)(face->extra.data); bchar_index = cff_lookup_glyph_by_stdcharcode( cff, bchar ); achar_index = cff_lookup_glyph_by_stdcharcode( cff, achar ); } if ( bchar_index < 0 || achar_index < 0 ) { FT_ERROR(( "cff_operator_seac:" " invalid seac character code arguments\n" )); return CFF_Err_Syntax_Error; } /* If we are trying to load a composite glyph, do not load the */ /* accent character and return the array of subglyphs. */ if ( builder->no_recurse ) { FT_GlyphSlot glyph = (FT_GlyphSlot)builder->glyph; FT_GlyphLoader loader = glyph->internal->loader; FT_SubGlyph subg; /* reallocate subglyph array if necessary */ error = FT_GlyphLoader_CheckSubGlyphs( loader, 2 ); if ( error ) goto Exit; subg = loader->current.subglyphs; /* subglyph 0 = base character */ subg->index = bchar_index; subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES | FT_SUBGLYPH_FLAG_USE_MY_METRICS; subg->arg1 = 0; subg->arg2 = 0; subg++; /* subglyph 1 = accent character */ subg->index = achar_index; subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES; subg->arg1 = (FT_Int)( adx >> 16 ); subg->arg2 = (FT_Int)( ady >> 16 ); /* set up remaining glyph fields */ glyph->num_subglyphs = 2; glyph->subglyphs = loader->base.subglyphs; glyph->format = FT_GLYPH_FORMAT_COMPOSITE; loader->current.num_subglyphs = 2; } FT_GlyphLoader_Prepare( builder->loader ); /* First load `bchar' in builder */ error = cff_get_glyph_data( face, bchar_index, &charstring, &charstring_len ); if ( !error ) { /* the seac operator must not be nested */ decoder->seac = TRUE; error = cff_decoder_parse_charstrings( decoder, charstring, charstring_len ); decoder->seac = FALSE; if ( error ) goto Exit; cff_free_glyph_data( face, &charstring, charstring_len ); } /* Save the left bearing, advance and glyph width of the base */ /* character as they will be erased by the next load. */ left_bearing = builder->left_bearing; advance = builder->advance; glyph_width = decoder->glyph_width; builder->left_bearing.x = 0; builder->left_bearing.y = 0; builder->pos_x = adx - asb; builder->pos_y = ady; /* Now load `achar' on top of the base outline. */ error = cff_get_glyph_data( face, achar_index, &charstring, &charstring_len ); if ( !error ) { /* the seac operator must not be nested */ decoder->seac = TRUE; error = cff_decoder_parse_charstrings( decoder, charstring, charstring_len ); decoder->seac = FALSE; if ( error ) goto Exit; cff_free_glyph_data( face, &charstring, charstring_len ); } /* Restore the left side bearing, advance and glyph width */ /* of the base character. */ builder->left_bearing = left_bearing; builder->advance = advance; decoder->glyph_width = glyph_width; builder->pos_x = 0; builder->pos_y = 0; Exit: return error; }
CWE-189
10,361
17,031
325970544562716884473000951453735438137
null
null
null
savannah
7d3d2cc4fef72c6be9c454b3809c387e12b44cfc
0
cff_slot_load( CFF_GlyphSlot glyph, CFF_Size size, FT_UInt glyph_index, FT_Int32 load_flags ) { FT_Error error; CFF_Decoder decoder; TT_Face face = (TT_Face)glyph->root.face; FT_Bool hinting, force_scaling; CFF_Font cff = (CFF_Font)face->extra.data; FT_Matrix font_matrix; FT_Vector font_offset; force_scaling = FALSE; /* in a CID-keyed font, consider `glyph_index' as a CID and map */ /* it immediately to the real glyph_index -- if it isn't a */ /* subsetted font, glyph_indices and CIDs are identical, though */ if ( cff->top_font.font_dict.cid_registry != 0xFFFFU && cff->charset.cids ) { /* don't handle CID 0 (.notdef) which is directly mapped to GID 0 */ if ( glyph_index != 0 ) { glyph_index = cff_charset_cid_to_gindex( &cff->charset, glyph_index ); if ( glyph_index == 0 ) return CFF_Err_Invalid_Argument; } } else if ( glyph_index >= cff->num_glyphs ) return CFF_Err_Invalid_Argument; if ( load_flags & FT_LOAD_NO_RECURSE ) load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING; glyph->x_scale = 0x10000L; glyph->y_scale = 0x10000L; if ( size ) { glyph->x_scale = size->root.metrics.x_scale; glyph->y_scale = size->root.metrics.y_scale; } #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS /* try to load embedded bitmap if any */ /* */ /* XXX: The convention should be emphasized in */ /* the documents because it can be confusing. */ if ( size ) { CFF_Face cff_face = (CFF_Face)size->root.face; SFNT_Service sfnt = (SFNT_Service)cff_face->sfnt; FT_Stream stream = cff_face->root.stream; if ( size->strike_index != 0xFFFFFFFFUL && sfnt->load_eblc && ( load_flags & FT_LOAD_NO_BITMAP ) == 0 ) { TT_SBit_MetricsRec metrics; error = sfnt->load_sbit_image( face, size->strike_index, glyph_index, (FT_Int)load_flags, stream, &glyph->root.bitmap, &metrics ); if ( !error ) { glyph->root.outline.n_points = 0; glyph->root.outline.n_contours = 0; glyph->root.metrics.width = (FT_Pos)metrics.width << 6; glyph->root.metrics.height = (FT_Pos)metrics.height << 6; glyph->root.metrics.horiBearingX = (FT_Pos)metrics.horiBearingX << 6; glyph->root.metrics.horiBearingY = (FT_Pos)metrics.horiBearingY << 6; glyph->root.metrics.horiAdvance = (FT_Pos)metrics.horiAdvance << 6; glyph->root.metrics.vertBearingX = (FT_Pos)metrics.vertBearingX << 6; glyph->root.metrics.vertBearingY = (FT_Pos)metrics.vertBearingY << 6; glyph->root.metrics.vertAdvance = (FT_Pos)metrics.vertAdvance << 6; glyph->root.format = FT_GLYPH_FORMAT_BITMAP; if ( load_flags & FT_LOAD_VERTICAL_LAYOUT ) { glyph->root.bitmap_left = metrics.vertBearingX; glyph->root.bitmap_top = metrics.vertBearingY; } else { glyph->root.bitmap_left = metrics.horiBearingX; glyph->root.bitmap_top = metrics.horiBearingY; } return error; } } } #endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */ /* return immediately if we only want the embedded bitmaps */ if ( load_flags & FT_LOAD_SBITS_ONLY ) return CFF_Err_Invalid_Argument; /* if we have a CID subfont, use its matrix (which has already */ /* been multiplied with the root matrix) */ /* this scaling is only relevant if the PS hinter isn't active */ if ( cff->num_subfonts ) { FT_ULong top_upm, sub_upm; FT_Byte fd_index = cff_fd_select_get( &cff->fd_select, glyph_index ); if ( fd_index >= cff->num_subfonts ) fd_index = cff->num_subfonts - 1; top_upm = cff->top_font.font_dict.units_per_em; sub_upm = cff->subfonts[fd_index]->font_dict.units_per_em; font_matrix = cff->subfonts[fd_index]->font_dict.font_matrix; font_offset = cff->subfonts[fd_index]->font_dict.font_offset; if ( top_upm != sub_upm ) { glyph->x_scale = FT_MulDiv( glyph->x_scale, top_upm, sub_upm ); glyph->y_scale = FT_MulDiv( glyph->y_scale, top_upm, sub_upm ); force_scaling = TRUE; } } else { font_matrix = cff->top_font.font_dict.font_matrix; font_offset = cff->top_font.font_dict.font_offset; } glyph->root.outline.n_points = 0; glyph->root.outline.n_contours = 0; hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 && ( load_flags & FT_LOAD_NO_HINTING ) == 0 ); glyph->root.format = FT_GLYPH_FORMAT_OUTLINE; /* by default */ { FT_Byte* charstring; FT_ULong charstring_len; cff_decoder_init( &decoder, face, size, glyph, hinting, FT_LOAD_TARGET_MODE( load_flags ) ); if ( load_flags & FT_LOAD_ADVANCE_ONLY ) decoder.width_only = TRUE; decoder.builder.no_recurse = (FT_Bool)( load_flags & FT_LOAD_NO_RECURSE ); /* now load the unscaled outline */ error = cff_get_glyph_data( face, glyph_index, &charstring, &charstring_len ); if ( !error ) { error = cff_decoder_prepare( &decoder, size, glyph_index ); if ( !error ) { error = cff_decoder_parse_charstrings( &decoder, charstring, charstring_len ); cff_free_glyph_data( face, &charstring, charstring_len ); #ifdef FT_CONFIG_OPTION_INCREMENTAL /* Control data and length may not be available for incremental */ /* fonts. */ if ( face->root.internal->incremental_interface ) { glyph->root.control_data = 0; glyph->root.control_len = 0; } else #endif /* FT_CONFIG_OPTION_INCREMENTAL */ /* We set control_data and control_len if charstrings is loaded. */ /* See how charstring loads at cff_index_access_element() in */ /* cffload.c. */ { CFF_Index csindex = &cff->charstrings_index; if ( csindex->offsets ) { glyph->root.control_data = csindex->bytes + csindex->offsets[glyph_index] - 1; glyph->root.control_len = charstring_len; } } } } /* save new glyph tables */ cff_builder_done( &decoder.builder ); } #ifdef FT_CONFIG_OPTION_INCREMENTAL /* Incremental fonts can optionally override the metrics. */ if ( !error && face->root.internal->incremental_interface && face->root.internal->incremental_interface->funcs->get_glyph_metrics ) { FT_Incremental_MetricsRec metrics; metrics.bearing_x = decoder.builder.left_bearing.x; metrics.bearing_y = 0; metrics.advance = decoder.builder.advance.x; metrics.advance_v = decoder.builder.advance.y; error = face->root.internal->incremental_interface->funcs->get_glyph_metrics( face->root.internal->incremental_interface->object, glyph_index, FALSE, &metrics ); decoder.builder.left_bearing.x = metrics.bearing_x; decoder.builder.advance.x = metrics.advance; decoder.builder.advance.y = metrics.advance_v; } #endif /* FT_CONFIG_OPTION_INCREMENTAL */ if ( !error ) { /* Now, set the metrics -- this is rather simple, as */ /* the left side bearing is the xMin, and the top side */ /* bearing the yMax. */ /* For composite glyphs, return only left side bearing and */ /* advance width. */ if ( load_flags & FT_LOAD_NO_RECURSE ) { FT_Slot_Internal internal = glyph->root.internal; glyph->root.metrics.horiBearingX = decoder.builder.left_bearing.x; glyph->root.metrics.horiAdvance = decoder.glyph_width; internal->glyph_matrix = font_matrix; internal->glyph_delta = font_offset; internal->glyph_transformed = 1; } else { FT_BBox cbox; FT_Glyph_Metrics* metrics = &glyph->root.metrics; FT_Vector advance; FT_Bool has_vertical_info; /* copy the _unscaled_ advance width */ metrics->horiAdvance = decoder.glyph_width; glyph->root.linearHoriAdvance = decoder.glyph_width; glyph->root.internal->glyph_transformed = 0; #ifdef FT_CONFIG_OPTION_OLD_INTERNALS has_vertical_info = FT_BOOL( face->vertical_info && face->vertical.number_Of_VMetrics > 0 && face->vertical.long_metrics ); #else has_vertical_info = FT_BOOL( face->vertical_info && face->vertical.number_Of_VMetrics > 0 ); #endif /* get the vertical metrics from the vtmx table if we have one */ if ( has_vertical_info ) { FT_Short vertBearingY = 0; FT_UShort vertAdvance = 0; ( (SFNT_Service)face->sfnt )->get_metrics( face, 1, glyph_index, &vertBearingY, &vertAdvance ); metrics->vertBearingY = vertBearingY; metrics->vertAdvance = vertAdvance; } else { /* make up vertical ones */ if ( face->os2.version != 0xFFFFU ) metrics->vertAdvance = (FT_Pos)( face->os2.sTypoAscender - face->os2.sTypoDescender ); else metrics->vertAdvance = (FT_Pos)( face->horizontal.Ascender - face->horizontal.Descender ); } glyph->root.linearVertAdvance = metrics->vertAdvance; glyph->root.format = FT_GLYPH_FORMAT_OUTLINE; glyph->root.outline.flags = 0; if ( size && size->root.metrics.y_ppem < 24 ) glyph->root.outline.flags |= FT_OUTLINE_HIGH_PRECISION; glyph->root.outline.flags |= FT_OUTLINE_REVERSE_FILL; if ( !( font_matrix.xx == 0x10000L && font_matrix.yy == 0x10000L && font_matrix.xy == 0 && font_matrix.yx == 0 ) ) FT_Outline_Transform( &glyph->root.outline, &font_matrix ); if ( !( font_offset.x == 0 && font_offset.y == 0 ) ) FT_Outline_Translate( &glyph->root.outline, font_offset.x, font_offset.y ); advance.x = metrics->horiAdvance; advance.y = 0; FT_Vector_Transform( &advance, &font_matrix ); metrics->horiAdvance = advance.x + font_offset.x; advance.x = 0; advance.y = metrics->vertAdvance; FT_Vector_Transform( &advance, &font_matrix ); metrics->vertAdvance = advance.y + font_offset.y; if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 || force_scaling ) { /* scale the outline and the metrics */ FT_Int n; FT_Outline* cur = &glyph->root.outline; FT_Vector* vec = cur->points; FT_Fixed x_scale = glyph->x_scale; FT_Fixed y_scale = glyph->y_scale; /* First of all, scale the points */ if ( !hinting || !decoder.builder.hints_funcs ) for ( n = cur->n_points; n > 0; n--, vec++ ) { vec->x = FT_MulFix( vec->x, x_scale ); vec->y = FT_MulFix( vec->y, y_scale ); } /* Then scale the metrics */ metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, x_scale ); metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, y_scale ); } /* compute the other metrics */ FT_Outline_Get_CBox( &glyph->root.outline, &cbox ); metrics->width = cbox.xMax - cbox.xMin; metrics->height = cbox.yMax - cbox.yMin; metrics->horiBearingX = cbox.xMin; metrics->horiBearingY = cbox.yMax; if ( has_vertical_info ) metrics->vertBearingX = metrics->horiBearingX - metrics->horiAdvance / 2; else { if ( load_flags & FT_LOAD_VERTICAL_LAYOUT ) ft_synthesize_vertical_metrics( metrics, metrics->vertAdvance ); } } } return error; }
CWE-189
10,362
17,032
103949773075468857335363037880555974514
null
null
null
savannah
7d3d2cc4fef72c6be9c454b3809c387e12b44cfc
0
check_points( CFF_Builder* builder, FT_Int count ) { return FT_GLYPHLOADER_CHECK_POINTS( builder->loader, count, 0 ); }
CWE-189
10,363
17,033
5832496204115024542228166214338153279
null
null
null
libXv
d9da580b46a28ab497de2e94fdc7b9ff953dab17
0
XvQueryExtension( Display *dpy, unsigned int *p_version, unsigned int *p_revision, unsigned int *p_requestBase, unsigned int *p_eventBase, unsigned int *p_errorBase) { XExtDisplayInfo *info = xv_find_display(dpy); xvQueryExtensionReq *req; xvQueryExtensionReply rep; int status; XvCheckExtension(dpy, info, XvBadExtension); LockDisplay(dpy); XvGetReq(QueryExtension, req); if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { status = XvBadExtension; goto out; } *p_version = rep.version; *p_revision = rep.revision; *p_requestBase = info->codes->major_opcode; *p_eventBase = info->codes->first_event; *p_errorBase = info->codes->first_error; status = Success; out: UnlockDisplay(dpy); SyncHandle(); return status; }
CWE-125
10,364
17,034
339003388164779056610482364587025420616
null
null
null
accountsservice
bd51aa4cdac380f55d607f4ffdf2ab3c00d08721
0
account_type_from_pwent (struct passwd *pwent) { struct group *grp; gid_t wheel; gid_t *groups; gint ngroups; gint i; if (pwent->pw_uid == 0) { g_debug ("user is root so account type is administrator"); return ACCOUNT_TYPE_ADMINISTRATOR; } grp = getgrnam ("wheel"); if (grp == NULL) { g_debug ("wheel group not found"); return ACCOUNT_TYPE_STANDARD; } wheel = grp->gr_gid; ngroups = get_user_groups (pwent->pw_name, pwent->pw_gid, &groups); for (i = 0; i < ngroups; i++) { if (groups[i] == wheel) { g_free (groups); return ACCOUNT_TYPE_ADMINISTRATOR; } } g_free (groups); return ACCOUNT_TYPE_STANDARD; }
CWE-362
10,365
17,035
194644004220096956032505547298273835940
null
null
null
accountsservice
bd51aa4cdac380f55d607f4ffdf2ab3c00d08721
0
compute_object_path (User *user) { gchar *object_path; object_path = g_strdup_printf ("/org/freedesktop/Accounts/User%ld", (long) user->uid); return object_path; }
CWE-362
10,366
17,036
94939500206239265821960140681567259390
null
null
null
accountsservice
bd51aa4cdac380f55d607f4ffdf2ab3c00d08721
0
move_extra_data (const gchar *old_name, const gchar *new_name) { gchar *old_filename; gchar *new_filename; old_filename = g_build_filename ("/var/lib/AccountsService/users", old_name, NULL); new_filename = g_build_filename ("/var/lib/AccountsService/users", new_name, NULL); g_rename (old_filename, new_filename); g_free (old_filename); g_free (new_filename); }
CWE-362
10,367
17,037
88761578381476988239126335985143589819
null
null
null
accountsservice
bd51aa4cdac380f55d607f4ffdf2ab3c00d08721
0
save_extra_data (User *user) { gchar *filename; GKeyFile *keyfile; gchar *data; GError *error; keyfile = g_key_file_new (); user_local_save_to_keyfile (user, keyfile); error = NULL; data = g_key_file_to_data (keyfile, NULL, &error); if (error == NULL) { filename = g_build_filename ("/var/lib/AccountsService/users", user->user_name, NULL); g_file_set_contents (filename, data, -1, &error); g_free (filename); } if (error) { g_warning ("Saving data for user %s failed: %s", user->user_name, error->message); g_error_free (error); } g_key_file_free (keyfile); }
CWE-362
10,368
17,038
158263662798181762462374749823395128185
null
null
null
accountsservice
bd51aa4cdac380f55d607f4ffdf2ab3c00d08721
0
throw_error (GDBusMethodInvocation *context, gint error_code, const gchar *format, ...) { va_list args; gchar *message; va_start (args, format); message = g_strdup_vprintf (format, args); va_end (args); g_dbus_method_invocation_return_error (context, ERROR, error_code, "%s", message); g_free (message); }
CWE-362
10,369
17,039
293823141205039183330040484840275307825
null
null
null
accountsservice
bd51aa4cdac380f55d607f4ffdf2ab3c00d08721
0
user_change_real_name_authorized_cb (Daemon *daemon, User *user, GDBusMethodInvocation *context, gpointer data) { gchar *name = data; GError *error; const gchar *argv[6]; if (g_strcmp0 (user->real_name, name) != 0) { sys_log (context, "change real name of user '%s' (%d) to '%s'", user->user_name, user->uid, name); argv[0] = "/usr/sbin/usermod"; argv[1] = "-c"; argv[2] = name; argv[3] = "--"; argv[4] = user->user_name; argv[5] = NULL; error = NULL; if (!spawn_with_login_uid (context, argv, &error)) { throw_error (context, ERROR_FAILED, "running '%s' failed: %s", argv[0], error->message); g_error_free (error); return; } g_free (user->real_name); user->real_name = g_strdup (name); accounts_user_emit_changed (ACCOUNTS_USER (user)); g_object_notify (G_OBJECT (user), "real-name"); } accounts_user_complete_set_real_name (ACCOUNTS_USER (user), context); }
CWE-362
10,370
17,040
34841186620740135585004542633731573360
null
null
null
accountsservice
bd51aa4cdac380f55d607f4ffdf2ab3c00d08721
0
user_local_get_shell(User *user) { return user->shell; }
CWE-362
10,372
17,041
109073356828302831892473560094446463753
null
null
null
accountsservice
bd51aa4cdac380f55d607f4ffdf2ab3c00d08721
0
user_local_get_system_account (User *user) { return user->system_account; }
CWE-362
10,373
17,042
154683548444781678977286272612966505192
null
null
null
accountsservice
bd51aa4cdac380f55d607f4ffdf2ab3c00d08721
0
user_local_get_uid (User *user) { return user->uid; }
CWE-362
10,374
17,043
331049102753287325613278419661016980371
null
null
null
accountsservice
bd51aa4cdac380f55d607f4ffdf2ab3c00d08721
0
user_local_get_user_name (User *user) { return user->user_name; }
CWE-362
10,375
17,044
76228046080339069835127101770137194899
null
null
null
accountsservice
bd51aa4cdac380f55d607f4ffdf2ab3c00d08721
0
user_local_new (Daemon *daemon, uid_t uid) { User *user; user = g_object_new (TYPE_USER, NULL); user->daemon = daemon; user->uid = uid; return user; }
CWE-362
10,376
17,045
63428972524931078569055194879748996857
null
null
null
accountsservice
bd51aa4cdac380f55d607f4ffdf2ab3c00d08721
0
user_local_register (User *user) { GError *error = NULL; user->system_bus_connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error); if (user->system_bus_connection == NULL) { if (error != NULL) { g_critical ("error getting system bus: %s", error->message); g_error_free (error); } return; } user->object_path = compute_object_path (user); if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (user), user->system_bus_connection, user->object_path, &error)) { if (error != NULL) { g_critical ("error exporting user object: %s", error->message); g_error_free (error); } return; } }
CWE-362
10,377
17,046
62017865127919734917295955724762665533
null
null
null
accountsservice
bd51aa4cdac380f55d607f4ffdf2ab3c00d08721
0
user_local_save_to_keyfile (User *user, GKeyFile *keyfile) { if (user->email) g_key_file_set_string (keyfile, "User", "Email", user->email); if (user->language) g_key_file_set_string (keyfile, "User", "Language", user->language); if (user->x_session) g_key_file_set_string (keyfile, "User", "XSession", user->x_session); if (user->location) g_key_file_set_string (keyfile, "User", "Location", user->location); if (user->password_hint) g_key_file_set_string (keyfile, "User", "PasswordHint", user->password_hint); if (user->icon_file) g_key_file_set_string (keyfile, "User", "Icon", user->icon_file); }
CWE-362
10,378
17,047
42933337249589298041195844286123062541
null
null
null
accountsservice
bd51aa4cdac380f55d607f4ffdf2ab3c00d08721
0
user_local_unregister (User *user) { g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (user)); }
CWE-362
10,379
17,048
293044099280408961005176070744130203312
null
null
null
accountsservice
bd51aa4cdac380f55d607f4ffdf2ab3c00d08721
0
user_local_update_from_keyfile (User *user, GKeyFile *keyfile) { gchar *s; g_object_freeze_notify (G_OBJECT (user)); s = g_key_file_get_string (keyfile, "User", "Language", NULL); if (s != NULL) { /* TODO: validate / normalize */ g_free (user->language); user->language = s; } s = g_key_file_get_string (keyfile, "User", "XSession", NULL); if (s != NULL) { g_free (user->x_session); user->x_session = s; } s = g_key_file_get_string (keyfile, "User", "Email", NULL); if (s != NULL) { g_free (user->email); user->email = s; } s = g_key_file_get_string (keyfile, "User", "Location", NULL); if (s != NULL) { g_free (user->location); user->location = s; } s = g_key_file_get_string (keyfile, "User", "PasswordHint", NULL); if (s != NULL) { g_free (user->password_hint); user->password_hint = s; } s = g_key_file_get_string (keyfile, "User", "Icon", NULL); if (s != NULL) { g_free (user->icon_file); user->icon_file = s; } g_object_thaw_notify (G_OBJECT (user)); }
CWE-362
10,380
17,049
3803286850335818493234551909886345422
null
null
null
accountsservice
bd51aa4cdac380f55d607f4ffdf2ab3c00d08721
0
user_local_update_from_pwent (User *user, struct passwd *pwent) { #ifdef HAVE_SHADOW_H struct spwd *spent; #endif gchar *real_name; gboolean changed; const gchar *passwd; gboolean locked; PasswordMode mode; g_object_freeze_notify (G_OBJECT (user)); changed = FALSE; if (pwent->pw_gecos && pwent->pw_gecos[0] != '\0') { gchar *first_comma = NULL; gchar *valid_utf8_name = NULL; if (g_utf8_validate (pwent->pw_gecos, -1, NULL)) { valid_utf8_name = pwent->pw_gecos; first_comma = g_utf8_strchr (valid_utf8_name, -1, ','); } else { g_warning ("User %s has invalid UTF-8 in GECOS field. " "It would be a good thing to check /etc/passwd.", pwent->pw_name ? pwent->pw_name : ""); } if (first_comma) { real_name = g_strndup (valid_utf8_name, (first_comma - valid_utf8_name)); } else if (valid_utf8_name) { real_name = g_strdup (valid_utf8_name); } else { real_name = NULL; } if (real_name && real_name[0] == '\0') { g_free (real_name); real_name = NULL; } } else { real_name = NULL; } if (g_strcmp0 (real_name, user->real_name) != 0) { g_free (user->real_name); user->real_name = real_name; changed = TRUE; g_object_notify (G_OBJECT (user), "real-name"); } else { g_free (real_name); } /* UID */ if (pwent->pw_uid != user->uid) { user->uid = pwent->pw_uid; changed = TRUE; g_object_notify (G_OBJECT (user), "uid"); } /* GID */ user->gid = pwent->pw_gid; user->account_type = account_type_from_pwent (pwent); /* Username */ if (g_strcmp0 (user->user_name, pwent->pw_name) != 0) { g_free (user->user_name); user->user_name = g_strdup (pwent->pw_name); changed = TRUE; g_object_notify (G_OBJECT (user), "user-name"); } /* Home Directory */ if (g_strcmp0 (user->home_dir, pwent->pw_dir) != 0) { g_free (user->home_dir); user->home_dir = g_strdup (pwent->pw_dir); g_free (user->default_icon_file); user->default_icon_file = g_build_filename (user->home_dir, ".face", NULL); changed = TRUE; g_object_notify (G_OBJECT (user), "home-directory"); } /* Shell */ if (g_strcmp0 (user->shell, pwent->pw_shell) != 0) { g_free (user->shell); user->shell = g_strdup (pwent->pw_shell); changed = TRUE; g_object_notify (G_OBJECT (user), "shell"); } passwd = pwent->pw_passwd; #ifdef HAVE_SHADOW_H spent = getspnam (pwent->pw_name); if (spent) passwd = spent->sp_pwdp; #endif if (passwd && passwd[0] == '!') { locked = TRUE; } else { locked = FALSE; } if (user->locked != locked) { user->locked = locked; changed = TRUE; g_object_notify (G_OBJECT (user), "locked"); } if (passwd && passwd[0] != 0) { mode = PASSWORD_MODE_REGULAR; } else { mode = PASSWORD_MODE_NONE; } #ifdef HAVE_SHADOW_H if (spent) { if (spent->sp_lstchg == 0) { mode = PASSWORD_MODE_SET_AT_LOGIN; } } #endif if (user->password_mode != mode) { user->password_mode = mode; changed = TRUE; g_object_notify (G_OBJECT (user), "password-mode"); } user->system_account = daemon_local_user_is_excluded (user->daemon, user->user_name, pwent->pw_shell); g_object_thaw_notify (G_OBJECT (user)); if (changed) accounts_user_emit_changed (ACCOUNTS_USER (user)); }
CWE-362
10,381
17,050
138863737839501937562518006658088728903
null
null
null
accountsservice
26213aa0e0d8dca5f36cc23f6942525224cbe9f5
0
_polkit_subject_get_cmdline (PolkitSubject *subject, gint *pid, gint *uid) { PolkitSubject *process; gchar *ret; gchar *filename; gchar *contents; gsize contents_len; GError *error; guint n; g_return_val_if_fail (subject != NULL, NULL); error = NULL; ret = NULL; process = NULL; filename = NULL; contents = NULL; if (POLKIT_IS_UNIX_PROCESS (subject)) { process = g_object_ref (subject); } else if (POLKIT_IS_SYSTEM_BUS_NAME (subject)) { process = polkit_system_bus_name_get_process_sync (POLKIT_SYSTEM_BUS_NAME (subject), NULL, &error); if (process == NULL) { g_warning ("Error getting process for system bus name `%s': %s", polkit_system_bus_name_get_name (POLKIT_SYSTEM_BUS_NAME (subject)), error->message); g_error_free (error); goto out; } } else { g_warning ("Unknown subject type passed to guess_program_name()"); goto out; } *pid = polkit_unix_process_get_pid (POLKIT_UNIX_PROCESS (process)); *uid = polkit_unix_process_get_uid (POLKIT_UNIX_PROCESS (process)); filename = g_strdup_printf ("/proc/%d/cmdline", *pid); if (!g_file_get_contents (filename, &contents, &contents_len, &error)) { g_warning ("Error openeing `%s': %s", filename, error->message); g_error_free (error); goto out; } /* The kernel uses '\0' to separate arguments - replace those with a space. */ for (n = 0; n < contents_len - 1; n++) { if (contents[n] == '\0') contents[n] = ' '; } ret = g_strdup (contents); g_strstrip (ret); out: g_free (filename); g_free (contents); if (process != NULL) g_object_unref (process); return ret; }
CWE-362
10,382
17,051
38458345485767230969378869226690976682
null
null
null
accountsservice
26213aa0e0d8dca5f36cc23f6942525224cbe9f5
0
get_caller_loginuid (GDBusMethodInvocation *context, gchar *loginuid, gint size) { PolkitSubject *subject; gchar *cmdline; gint pid; gint uid; gchar *path; gchar *buf; subject = polkit_system_bus_name_new (g_dbus_method_invocation_get_sender (context)); cmdline = _polkit_subject_get_cmdline (subject, &pid, &uid); g_free (cmdline); g_object_unref (subject); path = g_strdup_printf ("/proc/%d/loginuid", pid); if (g_file_get_contents (path, &buf, NULL, NULL)) { strncpy (loginuid, buf, size); g_free (buf); } else { g_snprintf (loginuid, size, "%d", uid); } g_free (path); }
CWE-362
10,383
17,052
154607089577560068136159676697677719230
null
null
null
accountsservice
26213aa0e0d8dca5f36cc23f6942525224cbe9f5
0
get_user_groups (const gchar *user, gid_t group, gid_t **groups) { gint res; gint ngroups; ngroups = 0; res = getgrouplist (user, group, NULL, &ngroups); g_debug ("user %s has %d groups\n", user, ngroups); *groups = g_new (gid_t, ngroups); res = getgrouplist (user, group, *groups, &ngroups); return res; }
CWE-362
10,384
17,053
285204728931813989725971891633885975585
null
null
null
accountsservice
26213aa0e0d8dca5f36cc23f6942525224cbe9f5
0
setup_loginuid (gpointer data) { const char *id = data; int fd; fd = open ("/proc/self/loginuid", O_WRONLY); write (fd, id, strlen (id)); close (fd); }
CWE-362
10,385
17,054
36519460511126814378040181497559530988
null
null
null
accountsservice
26213aa0e0d8dca5f36cc23f6942525224cbe9f5
0
spawn_with_login_uid (GDBusMethodInvocation *context, const gchar *argv[], GError **error) { GError *local_error; gchar loginuid[20]; gchar *std_err; gint status; get_caller_loginuid (context, loginuid, 20); local_error = NULL; std_err = NULL; if (!g_spawn_sync (NULL, (gchar**)argv, NULL, 0, setup_loginuid, loginuid, NULL, &std_err, &status, &local_error)) { g_propagate_error (error, local_error); g_free (std_err); return FALSE; } if (WEXITSTATUS (status) != 0) { g_set_error (error, G_SPAWN_ERROR, G_SPAWN_ERROR_FAILED, "%s returned an error (%d): %s", argv[0], WEXITSTATUS(status), std_err); g_free (std_err); return FALSE; } g_free (std_err); return TRUE; }
CWE-362
10,386
17,055
226128934120204286377192748273770386018
null
null
null
accountsservice
26213aa0e0d8dca5f36cc23f6942525224cbe9f5
0
sys_log (GDBusMethodInvocation *context, const gchar *format, ...) { va_list args; gchar *msg; va_start (args, format); msg = g_strdup_vprintf (format, args); va_end (args); if (context) { PolkitSubject *subject; gchar *cmdline; gchar *id; gint pid = 0; gint uid = 0; gchar *tmp; subject = polkit_system_bus_name_new (g_dbus_method_invocation_get_sender (context)); id = polkit_subject_to_string (subject); cmdline = _polkit_subject_get_cmdline (subject, &pid, &uid); if (cmdline == NULL) { tmp = g_strdup_printf ("request by %s: %s", id, msg); } else { tmp = g_strdup_printf ("request by %s [%s pid:%d uid:%d]: %s", id, cmdline, pid, uid, msg); } g_free (msg); msg = tmp; g_free (id); g_free (cmdline); g_object_unref (subject); } syslog (LOG_NOTICE, "%s", msg); g_free (msg); }
CWE-362
10,387
17,056
104615394675190508355201225902149011185
null
null
null
savannah
f290f48a621867084884bfff87f8093c15195e6a
0
do_ed_script (char const *inname, char const *outname, bool *outname_needs_removal, FILE *ofp) { static char const editor_program[] = EDITOR_PROGRAM; file_offset beginning_of_this_line; FILE *pipefp = 0; size_t chars_read; if (! dry_run && ! skip_rest_of_patch) { int exclusive = *outname_needs_removal ? 0 : O_EXCL; assert (! inerrno); *outname_needs_removal = true; copy_file (inname, outname, 0, exclusive, instat.st_mode, true); sprintf (buf, "%s %s%s", editor_program, verbosity == VERBOSE ? "" : "- ", outname); fflush (stdout); pipefp = popen(buf, binary_transput ? "wb" : "w"); if (!pipefp) pfatal ("Can't open pipe to %s", quotearg (buf)); } for (;;) { char ed_command_letter; beginning_of_this_line = file_tell (pfp); chars_read = get_line (); if (! chars_read) { next_intuit_at(beginning_of_this_line,p_input_line); break; } ed_command_letter = get_ed_command_letter (buf); if (ed_command_letter) { if (pipefp) if (! fwrite (buf, sizeof *buf, chars_read, pipefp)) write_fatal (); if (ed_command_letter != 'd' && ed_command_letter != 's') { p_pass_comments_through = true; while ((chars_read = get_line ()) != 0) { if (pipefp) if (! fwrite (buf, sizeof *buf, chars_read, pipefp)) write_fatal (); if (chars_read == 2 && strEQ (buf, ".\n")) break; } p_pass_comments_through = false; } } else { next_intuit_at(beginning_of_this_line,p_input_line); break; } } if (!pipefp) return; if (fwrite ("w\nq\n", sizeof (char), (size_t) 4, pipefp) == 0 || fflush (pipefp) != 0) write_fatal (); if (pclose (pipefp) != 0) fatal ("%s FAILED", editor_program); if (ofp) { FILE *ifp = fopen (outname, binary_transput ? "rb" : "r"); int c; if (!ifp) pfatal ("can't open '%s'", outname); while ((c = getc (ifp)) != EOF) if (putc (c, ofp) == EOF) write_fatal (); if (ferror (ifp) || fclose (ifp) != 0) read_fatal (); } }
CWE-476
10,560
17,075
152008592241915209851572423953073192606
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Compute_Funcs( TT_ExecContext exc ) { if ( exc->GS.freeVector.x == 0x4000 ) exc->F_dot_P = exc->GS.projVector.x; else if ( exc->GS.freeVector.y == 0x4000 ) exc->F_dot_P = exc->GS.projVector.y; else exc->F_dot_P = ( (FT_Long)exc->GS.projVector.x * exc->GS.freeVector.x + (FT_Long)exc->GS.projVector.y * exc->GS.freeVector.y ) >> 14; if ( exc->GS.projVector.x == 0x4000 ) exc->func_project = (TT_Project_Func)Project_x; else if ( exc->GS.projVector.y == 0x4000 ) exc->func_project = (TT_Project_Func)Project_y; else exc->func_project = (TT_Project_Func)Project; if ( exc->GS.dualVector.x == 0x4000 ) exc->func_dualproj = (TT_Project_Func)Project_x; else if ( exc->GS.dualVector.y == 0x4000 ) exc->func_dualproj = (TT_Project_Func)Project_y; else exc->func_dualproj = (TT_Project_Func)Dual_Project; exc->func_move = (TT_Move_Func)Direct_Move; exc->func_move_orig = (TT_Move_Func)Direct_Move_Orig; if ( exc->F_dot_P == 0x4000L ) { if ( exc->GS.freeVector.x == 0x4000 ) { exc->func_move = (TT_Move_Func)Direct_Move_X; exc->func_move_orig = (TT_Move_Func)Direct_Move_Orig_X; } else if ( exc->GS.freeVector.y == 0x4000 ) { exc->func_move = (TT_Move_Func)Direct_Move_Y; exc->func_move_orig = (TT_Move_Func)Direct_Move_Orig_Y; } } /* at small sizes, F_dot_P can become too small, resulting */ /* in overflows and `spikes' in a number of glyphs like `w'. */ if ( FT_ABS( exc->F_dot_P ) < 0x400L ) exc->F_dot_P = 0x4000L; /* Disable cached aspect ratio */ exc->tt_metrics.ratio = 0; }
CWE-476
10,561
17,076
174689256097735241014745326891615201756
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Compute_Point_Displacement( TT_ExecContext exc, FT_F26Dot6* x, FT_F26Dot6* y, TT_GlyphZone zone, FT_UShort* refp ) { TT_GlyphZoneRec zp; FT_UShort p; FT_F26Dot6 d; if ( exc->opcode & 1 ) { zp = exc->zp0; p = exc->GS.rp1; } else { zp = exc->zp1; p = exc->GS.rp2; } if ( BOUNDS( p, zp.n_points ) ) { if ( exc->pedantic_hinting ) exc->error = FT_THROW( Invalid_Reference ); *refp = 0; return FAILURE; } *zone = zp; *refp = p; d = PROJECT( zp.cur + p, zp.org + p ); *x = FT_MulDiv( d, (FT_Long)exc->GS.freeVector.x, exc->F_dot_P ); *y = FT_MulDiv( d, (FT_Long)exc->GS.freeVector.y, exc->F_dot_P ); return SUCCESS; }
CWE-476
10,562
17,077
302174265474022362140592781356304057531
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Compute_Round( TT_ExecContext exc, FT_Byte round_mode ) { switch ( round_mode ) { case TT_Round_Off: exc->func_round = (TT_Round_Func)Round_None; break; case TT_Round_To_Grid: exc->func_round = (TT_Round_Func)Round_To_Grid; break; case TT_Round_Up_To_Grid: exc->func_round = (TT_Round_Func)Round_Up_To_Grid; break; case TT_Round_Down_To_Grid: exc->func_round = (TT_Round_Func)Round_Down_To_Grid; break; case TT_Round_To_Half_Grid: exc->func_round = (TT_Round_Func)Round_To_Half_Grid; break; case TT_Round_To_Double_Grid: exc->func_round = (TT_Round_Func)Round_To_Double_Grid; break; case TT_Round_Super: exc->func_round = (TT_Round_Func)Round_Super; break; case TT_Round_Super_45: exc->func_round = (TT_Round_Func)Round_Super_45; break; } }
CWE-476
10,563
17,078
33500330954118441365389701812222212242
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Current_Ppem( TT_ExecContext exc ) { return exc->tt_metrics.ppem; }
CWE-476
10,564
17,079
324074245701027665211831640812476157385
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Current_Ppem_Stretched( TT_ExecContext exc ) { return FT_MulFix( exc->tt_metrics.ppem, Current_Ratio( exc ) ); }
CWE-476
10,565
17,080
265901579805547164701544595067134469779
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Direct_Move( TT_ExecContext exc, TT_GlyphZone zone, FT_UShort point, FT_F26Dot6 distance ) { FT_F26Dot6 v; v = exc->GS.freeVector.x; if ( v != 0 ) { #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY if ( SUBPIXEL_HINTING_INFINALITY && ( !exc->ignore_x_mode || ( exc->sph_tweak_flags & SPH_TWEAK_ALLOW_X_DMOVE ) ) ) zone->cur[point].x = ADD_LONG( zone->cur[point].x, FT_MulDiv( distance, v, exc->F_dot_P ) ); else #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL /* Exception to the post-IUP curfew: Allow the x component of */ /* diagonal moves, but only post-IUP. DejaVu tries to adjust */ /* diagonal stems like on `Z' and `z' post-IUP. */ if ( SUBPIXEL_HINTING_MINIMAL && !exc->backward_compatibility ) zone->cur[point].x = ADD_LONG( zone->cur[point].x, FT_MulDiv( distance, v, exc->F_dot_P ) ); else #endif if ( NO_SUBPIXEL_HINTING ) zone->cur[point].x = ADD_LONG( zone->cur[point].x, FT_MulDiv( distance, v, exc->F_dot_P ) ); zone->tags[point] |= FT_CURVE_TAG_TOUCH_X; } v = exc->GS.freeVector.y; if ( v != 0 ) { #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL if ( !( SUBPIXEL_HINTING_MINIMAL && exc->backward_compatibility && exc->iupx_called && exc->iupy_called ) ) #endif zone->cur[point].y = ADD_LONG( zone->cur[point].y, FT_MulDiv( distance, v, exc->F_dot_P ) ); zone->tags[point] |= FT_CURVE_TAG_TOUCH_Y; } }
CWE-476
10,567
17,081
184592282497232190545199172476219894310
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Direct_Move_Orig_X( TT_ExecContext exc, TT_GlyphZone zone, FT_UShort point, FT_F26Dot6 distance ) { FT_UNUSED( exc ); zone->org[point].x = ADD_LONG( zone->org[point].x, distance ); }
CWE-476
10,569
17,082
267739011013406837829463334895805767675
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Direct_Move_X( TT_ExecContext exc, TT_GlyphZone zone, FT_UShort point, FT_F26Dot6 distance ) { #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY if ( SUBPIXEL_HINTING_INFINALITY && !exc->ignore_x_mode ) zone->cur[point].x = ADD_LONG( zone->cur[point].x, distance ); else #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL if ( SUBPIXEL_HINTING_MINIMAL && !exc->backward_compatibility ) zone->cur[point].x = ADD_LONG( zone->cur[point].x, distance ); else #endif if ( NO_SUBPIXEL_HINTING ) zone->cur[point].x = ADD_LONG( zone->cur[point].x, distance ); zone->tags[point] |= FT_CURVE_TAG_TOUCH_X; }
CWE-476
10,570
17,083
216898132570560019607116018416489718354
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Direct_Move_Y( TT_ExecContext exc, TT_GlyphZone zone, FT_UShort point, FT_F26Dot6 distance ) { FT_UNUSED( exc ); #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL if ( !( SUBPIXEL_HINTING_MINIMAL && exc->backward_compatibility && exc->iupx_called && exc->iupy_called ) ) #endif zone->cur[point].y = ADD_LONG( zone->cur[point].y, distance ); zone->tags[point] |= FT_CURVE_TAG_TOUCH_Y; }
CWE-476
10,571
17,084
201870256040946677776049864931150522739
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
GetShortIns( TT_ExecContext exc ) { /* Reading a byte stream so there is no endianness (DaveP) */ exc->IP += 2; return (FT_Short)( ( exc->code[exc->IP - 2] << 8 ) + exc->code[exc->IP - 1] ); }
CWE-476
10,573
17,085
248999794608250177860169121793746220967
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Init_Context( TT_ExecContext exec, FT_Memory memory ) { FT_Error error; FT_TRACE1(( "Init_Context: new object at 0x%08p\n", exec )); exec->memory = memory; exec->callSize = 32; if ( FT_NEW_ARRAY( exec->callStack, exec->callSize ) ) goto Fail_Memory; /* all values in the context are set to 0 already, but this is */ /* here as a remainder */ exec->maxPoints = 0; exec->maxContours = 0; exec->stackSize = 0; exec->glyphSize = 0; exec->stack = NULL; exec->glyphIns = NULL; exec->face = NULL; exec->size = NULL; return FT_Err_Ok; Fail_Memory: FT_ERROR(( "Init_Context: not enough memory for %p\n", exec )); TT_Done_Context( exec ); return error; }
CWE-476
10,574
17,086
237719946078483998973177693483808428698
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_AA( void ) { /* intentionally no longer supported */ }
CWE-476
10,575
17,087
19848661498602377644340050451895782953
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_ABS( FT_Long* args ) { if ( args[0] < 0 ) args[0] = NEG_LONG( args[0] ); }
CWE-476
10,576
17,088
186858060677691771280414882081498628425
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_ADD( FT_Long* args ) { args[0] = ADD_LONG( args[0], args[1] ); }
CWE-476
10,577
17,089
16707218188016135666548493347941321454
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_ALIGNPTS( TT_ExecContext exc, FT_Long* args ) { FT_UShort p1, p2; FT_F26Dot6 distance; p1 = (FT_UShort)args[0]; p2 = (FT_UShort)args[1]; if ( BOUNDS( p1, exc->zp1.n_points ) || BOUNDS( p2, exc->zp0.n_points ) ) { if ( exc->pedantic_hinting ) exc->error = FT_THROW( Invalid_Reference ); return; } distance = PROJECT( exc->zp0.cur + p2, exc->zp1.cur + p1 ) / 2; exc->func_move( exc, &exc->zp1, p1, distance ); exc->func_move( exc, &exc->zp0, p2, NEG_LONG( distance ) ); }
CWE-476
10,578
17,090
103893983791458714772792172790646990754
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_ALIGNRP( TT_ExecContext exc ) { FT_UShort point; FT_F26Dot6 distance; #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY if ( SUBPIXEL_HINTING_INFINALITY && exc->ignore_x_mode && exc->iup_called && ( exc->sph_tweak_flags & SPH_TWEAK_NO_ALIGNRP_AFTER_IUP ) ) { exc->error = FT_THROW( Invalid_Reference ); goto Fail; } #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ if ( exc->top < exc->GS.loop || BOUNDS( exc->GS.rp0, exc->zp0.n_points ) ) { if ( exc->pedantic_hinting ) exc->error = FT_THROW( Invalid_Reference ); goto Fail; } while ( exc->GS.loop > 0 ) { exc->args--; point = (FT_UShort)exc->stack[exc->args]; if ( BOUNDS( point, exc->zp1.n_points ) ) { if ( exc->pedantic_hinting ) { exc->error = FT_THROW( Invalid_Reference ); return; } } else { distance = PROJECT( exc->zp1.cur + point, exc->zp0.cur + exc->GS.rp0 ); exc->func_move( exc, &exc->zp1, point, NEG_LONG( distance ) ); } exc->GS.loop--; } Fail: exc->GS.loop = 1; exc->new_top = exc->args; }
CWE-476
10,579
17,091
143504051696831363148773205114018684083
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_AND( FT_Long* args ) { args[0] = ( args[0] && args[1] ); }
CWE-476
10,580
17,092
327886537210268815942765833774390606452
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_CALL( TT_ExecContext exc, FT_Long* args ) { FT_ULong F; TT_CallRec* pCrec; TT_DefRecord* def; /* first of all, check the index */ F = (FT_ULong)args[0]; if ( BOUNDSL( F, exc->maxFunc + 1 ) ) goto Fail; /* Except for some old Apple fonts, all functions in a TrueType */ /* font are defined in increasing order, starting from 0. This */ /* means that we normally have */ /* */ /* exc->maxFunc+1 == exc->numFDefs */ /* exc->FDefs[n].opc == n for n in 0..exc->maxFunc */ /* */ /* If this isn't true, we need to look up the function table. */ def = exc->FDefs + F; if ( exc->maxFunc + 1 != exc->numFDefs || def->opc != F ) { /* look up the FDefs table */ TT_DefRecord* limit; def = exc->FDefs; limit = def + exc->numFDefs; while ( def < limit && def->opc != F ) def++; if ( def == limit ) goto Fail; } /* check that the function is active */ if ( !def->active ) goto Fail; #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY if ( SUBPIXEL_HINTING_INFINALITY && exc->ignore_x_mode && ( ( exc->iup_called && ( exc->sph_tweak_flags & SPH_TWEAK_NO_CALL_AFTER_IUP ) ) || ( def->sph_fdef_flags & SPH_FDEF_VACUFORM_ROUND_1 ) ) ) goto Fail; else exc->sph_in_func_flags = def->sph_fdef_flags; #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ /* check the call stack */ if ( exc->callTop >= exc->callSize ) { exc->error = FT_THROW( Stack_Overflow ); return; } pCrec = exc->callStack + exc->callTop; pCrec->Caller_Range = exc->curRange; pCrec->Caller_IP = exc->IP + 1; pCrec->Cur_Count = 1; pCrec->Def = def; exc->callTop++; Ins_Goto_CodeRange( exc, def->range, def->start ); exc->step_ins = FALSE; return; Fail: exc->error = FT_THROW( Invalid_Reference ); }
CWE-476
10,581
17,093
108639872547686528682952408358498284421
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_CINDEX( TT_ExecContext exc, FT_Long* args ) { FT_Long L; L = args[0]; if ( L <= 0 || L > exc->args ) { if ( exc->pedantic_hinting ) exc->error = FT_THROW( Invalid_Reference ); args[0] = 0; } else args[0] = exc->stack[exc->args - L]; }
CWE-476
10,583
17,094
188919976595599892787722915442092252603
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_CLEAR( TT_ExecContext exc ) { exc->new_top = 0; }
CWE-476
10,584
17,095
110275277825211711090910907994061277125
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_DEBUG( TT_ExecContext exc ) { exc->error = FT_THROW( Debug_OpCode ); }
CWE-476
10,585
17,096
51525988518631415710454811366232392970
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_DELTAC( TT_ExecContext exc, FT_Long* args ) { FT_ULong nump, k; FT_ULong A, C, P; FT_Long B; P = (FT_ULong)exc->func_cur_ppem( exc ); nump = (FT_ULong)args[0]; for ( k = 1; k <= nump; k++ ) { if ( exc->args < 2 ) { if ( exc->pedantic_hinting ) exc->error = FT_THROW( Too_Few_Arguments ); exc->args = 0; goto Fail; } exc->args -= 2; A = (FT_ULong)exc->stack[exc->args + 1]; B = exc->stack[exc->args]; if ( BOUNDSL( A, exc->cvtSize ) ) { if ( exc->pedantic_hinting ) { exc->error = FT_THROW( Invalid_Reference ); return; } } else { C = ( (FT_ULong)B & 0xF0 ) >> 4; switch ( exc->opcode ) { case 0x73: break; case 0x74: C += 16; break; case 0x75: C += 32; break; } C += exc->GS.delta_base; if ( P == C ) { B = ( (FT_ULong)B & 0xF ) - 8; if ( B >= 0 ) B++; B *= 1L << ( 6 - exc->GS.delta_shift ); exc->func_move_cvt( exc, A, B ); } } } Fail: exc->new_top = exc->args; }
CWE-476
10,586
17,097
125544071745191268778366203443700023857
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_DELTAP( TT_ExecContext exc, FT_Long* args ) { FT_ULong nump, k; FT_UShort A; FT_ULong C, P; FT_Long B; #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY FT_UShort B1, B2; if ( SUBPIXEL_HINTING_INFINALITY && exc->ignore_x_mode && exc->iup_called && ( exc->sph_tweak_flags & SPH_TWEAK_NO_DELTAP_AFTER_IUP ) ) goto Fail; #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ P = (FT_ULong)exc->func_cur_ppem( exc ); nump = (FT_ULong)args[0]; /* some points theoretically may occur more than once, thus UShort isn't enough */ for ( k = 1; k <= nump; k++ ) { if ( exc->args < 2 ) { if ( exc->pedantic_hinting ) exc->error = FT_THROW( Too_Few_Arguments ); exc->args = 0; goto Fail; } exc->args -= 2; A = (FT_UShort)exc->stack[exc->args + 1]; B = exc->stack[exc->args]; /* XXX: Because some popular fonts contain some invalid DeltaP */ /* instructions, we simply ignore them when the stacked */ /* point reference is off limit, rather than returning an */ /* error. As a delta instruction doesn't change a glyph */ /* in great ways, this shouldn't be a problem. */ if ( !BOUNDS( A, exc->zp0.n_points ) ) { C = ( (FT_ULong)B & 0xF0 ) >> 4; switch ( exc->opcode ) { case 0x5D: break; case 0x71: C += 16; break; case 0x72: C += 32; break; } C += exc->GS.delta_base; if ( P == C ) { B = ( (FT_ULong)B & 0xF ) - 8; if ( B >= 0 ) B++; B *= 1L << ( 6 - exc->GS.delta_shift ); #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY if ( SUBPIXEL_HINTING_INFINALITY ) { /* * Allow delta move if * * - not using ignore_x_mode rendering, * - glyph is specifically set to allow it, or * - glyph is composite and freedom vector is not in subpixel * direction. */ if ( !exc->ignore_x_mode || ( exc->sph_tweak_flags & SPH_TWEAK_ALWAYS_DO_DELTAP ) || ( exc->is_composite && exc->GS.freeVector.y != 0 ) ) exc->func_move( exc, &exc->zp0, A, B ); /* Otherwise, apply subpixel hinting and compatibility mode */ /* rules, always skipping deltas in subpixel direction. */ else if ( exc->ignore_x_mode && exc->GS.freeVector.y != 0 ) { /* save the y value of the point now; compare after move */ B1 = (FT_UShort)exc->zp0.cur[A].y; /* Standard subpixel hinting: Allow y move for y-touched */ /* points. This messes up DejaVu ... */ if ( !exc->face->sph_compatibility_mode && ( exc->zp0.tags[A] & FT_CURVE_TAG_TOUCH_Y ) ) exc->func_move( exc, &exc->zp0, A, B ); /* compatibility mode */ else if ( exc->face->sph_compatibility_mode && !( exc->sph_tweak_flags & SPH_TWEAK_ALWAYS_SKIP_DELTAP ) ) { if ( exc->sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES ) B = FT_PIX_ROUND( B1 + B ) - B1; /* Allow delta move if using sph_compatibility_mode, */ /* IUP has not been called, and point is touched on Y. */ if ( !exc->iup_called && ( exc->zp0.tags[A] & FT_CURVE_TAG_TOUCH_Y ) ) exc->func_move( exc, &exc->zp0, A, B ); } B2 = (FT_UShort)exc->zp0.cur[A].y; /* Reverse this move if it results in a disallowed move */ if ( exc->GS.freeVector.y != 0 && ( ( exc->face->sph_compatibility_mode && ( B1 & 63 ) == 0 && ( B2 & 63 ) != 0 ) || ( ( exc->sph_tweak_flags & SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES_DELTAP ) && ( B1 & 63 ) != 0 && ( B2 & 63 ) != 0 ) ) ) exc->func_move( exc, &exc->zp0, A, NEG_LONG( B ) ); } } else #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ { #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL /* See `ttinterp.h' for details on backward compatibility */ /* mode. */ if ( SUBPIXEL_HINTING_MINIMAL && exc->backward_compatibility ) { if ( !( exc->iupx_called && exc->iupy_called ) && ( ( exc->is_composite && exc->GS.freeVector.y != 0 ) || ( exc->zp0.tags[A] & FT_CURVE_TAG_TOUCH_Y ) ) ) exc->func_move( exc, &exc->zp0, A, B ); } else #endif exc->func_move( exc, &exc->zp0, A, B ); } } } else if ( exc->pedantic_hinting ) exc->error = FT_THROW( Invalid_Reference ); } Fail: exc->new_top = exc->args; }
CWE-476
10,587
17,098
204312249879917898372678017573854442756
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_DEPTH( TT_ExecContext exc, FT_Long* args ) { args[0] = exc->top; }
CWE-476
10,588
17,099
263585128263512346039806752559055259276
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_DIV( TT_ExecContext exc, FT_Long* args ) { if ( args[1] == 0 ) exc->error = FT_THROW( Divide_By_Zero ); else args[0] = FT_MulDiv_No_Round( args[0], 64L, args[1] ); }
CWE-476
10,589
17,100
175862870567848241739134595148276563012
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_DUP( FT_Long* args ) { args[1] = args[0]; }
CWE-476
10,590
17,101
311009468772806784394912509406133945216
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_EIF( void ) { /* nothing to do */ }
CWE-476
10,591
17,102
12218294804661032007899976651077946535
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_ELSE( TT_ExecContext exc ) { FT_Int nIfs; nIfs = 1; do { if ( SkipCode( exc ) == FAILURE ) return; switch ( exc->opcode ) { case 0x58: /* IF */ nIfs++; break; case 0x59: /* EIF */ nIfs--; break; } } while ( nIfs != 0 ); }
CWE-476
10,592
17,103
323021473768149961393046794470477321875
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_ENDF( TT_ExecContext exc ) { TT_CallRec* pRec; #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY exc->sph_in_func_flags = 0x0000; #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ if ( exc->callTop <= 0 ) /* We encountered an ENDF without a call */ { exc->error = FT_THROW( ENDF_In_Exec_Stream ); return; } exc->callTop--; pRec = &exc->callStack[exc->callTop]; pRec->Cur_Count--; exc->step_ins = FALSE; if ( pRec->Cur_Count > 0 ) { exc->callTop++; exc->IP = pRec->Def->start; } else /* Loop through the current function */ Ins_Goto_CodeRange( exc, pRec->Caller_Range, pRec->Caller_IP ); /* Exit the current call frame. */ /* NOTE: If the last instruction of a program is a */ /* CALL or LOOPCALL, the return address is */ /* always out of the code range. This is a */ /* valid address, and it is why we do not test */ /* the result of Ins_Goto_CodeRange() here! */ }
CWE-476
10,593
17,104
108573747932961079780773048583463669113
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_EQ( FT_Long* args ) { args[0] = ( args[0] == args[1] ); }
CWE-476
10,594
17,105
4840782352420319404335726034781007036
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_FDEF( TT_ExecContext exc, FT_Long* args ) { FT_ULong n; TT_DefRecord* rec; TT_DefRecord* limit; #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY /* arguments to opcodes are skipped by `SKIP_Code' */ FT_Byte opcode_pattern[9][12] = { /* #0 inline delta function 1 */ { 0x4B, /* PPEM */ 0x53, /* GTEQ */ 0x23, /* SWAP */ 0x4B, /* PPEM */ 0x51, /* LTEQ */ 0x5A, /* AND */ 0x58, /* IF */ 0x38, /* SHPIX */ 0x1B, /* ELSE */ 0x21, /* POP */ 0x21, /* POP */ 0x59 /* EIF */ }, /* #1 inline delta function 2 */ { 0x4B, /* PPEM */ 0x54, /* EQ */ 0x58, /* IF */ 0x38, /* SHPIX */ 0x1B, /* ELSE */ 0x21, /* POP */ 0x21, /* POP */ 0x59 /* EIF */ }, /* #2 diagonal stroke function */ { 0x20, /* DUP */ 0x20, /* DUP */ 0xB0, /* PUSHB_1 */ /* 1 */ 0x60, /* ADD */ 0x46, /* GC_cur */ 0xB0, /* PUSHB_1 */ /* 64 */ 0x23, /* SWAP */ 0x42 /* WS */ }, /* #3 VacuFormRound function */ { 0x45, /* RCVT */ 0x23, /* SWAP */ 0x46, /* GC_cur */ 0x60, /* ADD */ 0x20, /* DUP */ 0xB0 /* PUSHB_1 */ /* 38 */ }, /* #4 TTFautohint bytecode (old) */ { 0x20, /* DUP */ 0x64, /* ABS */ 0xB0, /* PUSHB_1 */ /* 32 */ 0x60, /* ADD */ 0x66, /* FLOOR */ 0x23, /* SWAP */ 0xB0 /* PUSHB_1 */ }, /* #5 spacing function 1 */ { 0x01, /* SVTCA_x */ 0xB0, /* PUSHB_1 */ /* 24 */ 0x43, /* RS */ 0x58 /* IF */ }, /* #6 spacing function 2 */ { 0x01, /* SVTCA_x */ 0x18, /* RTG */ 0xB0, /* PUSHB_1 */ /* 24 */ 0x43, /* RS */ 0x58 /* IF */ }, /* #7 TypeMan Talk DiagEndCtrl function */ { 0x01, /* SVTCA_x */ 0x20, /* DUP */ 0xB0, /* PUSHB_1 */ /* 3 */ 0x25, /* CINDEX */ }, /* #8 TypeMan Talk Align */ { 0x06, /* SPVTL */ 0x7D, /* RDTG */ }, }; FT_UShort opcode_patterns = 9; FT_UShort opcode_pointer[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; FT_UShort opcode_size[9] = { 12, 8, 8, 6, 7, 4, 5, 4, 2 }; FT_UShort i; #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ /* FDEF is only allowed in `prep' or `fpgm' */ if ( exc->curRange == tt_coderange_glyph ) { exc->error = FT_THROW( DEF_In_Glyf_Bytecode ); return; } /* some font programs are broken enough to redefine functions! */ /* We will then parse the current table. */ rec = exc->FDefs; limit = rec + exc->numFDefs; n = (FT_ULong)args[0]; for ( ; rec < limit; rec++ ) { if ( rec->opc == n ) break; } if ( rec == limit ) { /* check that there is enough room for new functions */ if ( exc->numFDefs >= exc->maxFDefs ) { exc->error = FT_THROW( Too_Many_Function_Defs ); return; } exc->numFDefs++; } /* Although FDEF takes unsigned 32-bit integer, */ /* func # must be within unsigned 16-bit integer */ if ( n > 0xFFFFU ) { exc->error = FT_THROW( Too_Many_Function_Defs ); return; } rec->range = exc->curRange; rec->opc = (FT_UInt16)n; rec->start = exc->IP + 1; rec->active = TRUE; rec->inline_delta = FALSE; rec->sph_fdef_flags = 0x0000; if ( n > exc->maxFunc ) exc->maxFunc = (FT_UInt16)n; #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY /* We don't know for sure these are typeman functions, */ /* however they are only active when RS 22 is called */ if ( n >= 64 && n <= 66 ) rec->sph_fdef_flags |= SPH_FDEF_TYPEMAN_STROKES; #endif /* Now skip the whole function definition. */ /* We don't allow nested IDEFS & FDEFs. */ while ( SkipCode( exc ) == SUCCESS ) { #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY if ( SUBPIXEL_HINTING_INFINALITY ) { for ( i = 0; i < opcode_patterns; i++ ) { if ( opcode_pointer[i] < opcode_size[i] && exc->opcode == opcode_pattern[i][opcode_pointer[i]] ) { opcode_pointer[i] += 1; if ( opcode_pointer[i] == opcode_size[i] ) { FT_TRACE6(( "sph: Function %d, opcode ptrn: %d, %s %s\n", i, n, exc->face->root.family_name, exc->face->root.style_name )); switch ( i ) { case 0: rec->sph_fdef_flags |= SPH_FDEF_INLINE_DELTA_1; exc->face->sph_found_func_flags |= SPH_FDEF_INLINE_DELTA_1; break; case 1: rec->sph_fdef_flags |= SPH_FDEF_INLINE_DELTA_2; exc->face->sph_found_func_flags |= SPH_FDEF_INLINE_DELTA_2; break; case 2: switch ( n ) { /* needs to be implemented still */ case 58: rec->sph_fdef_flags |= SPH_FDEF_DIAGONAL_STROKE; exc->face->sph_found_func_flags |= SPH_FDEF_DIAGONAL_STROKE; } break; case 3: switch ( n ) { case 0: rec->sph_fdef_flags |= SPH_FDEF_VACUFORM_ROUND_1; exc->face->sph_found_func_flags |= SPH_FDEF_VACUFORM_ROUND_1; } break; case 4: /* probably not necessary to detect anymore */ rec->sph_fdef_flags |= SPH_FDEF_TTFAUTOHINT_1; exc->face->sph_found_func_flags |= SPH_FDEF_TTFAUTOHINT_1; break; case 5: switch ( n ) { case 0: case 1: case 2: case 4: case 7: case 8: rec->sph_fdef_flags |= SPH_FDEF_SPACING_1; exc->face->sph_found_func_flags |= SPH_FDEF_SPACING_1; } break; case 6: switch ( n ) { case 0: case 1: case 2: case 4: case 7: case 8: rec->sph_fdef_flags |= SPH_FDEF_SPACING_2; exc->face->sph_found_func_flags |= SPH_FDEF_SPACING_2; } break; case 7: rec->sph_fdef_flags |= SPH_FDEF_TYPEMAN_DIAGENDCTRL; exc->face->sph_found_func_flags |= SPH_FDEF_TYPEMAN_DIAGENDCTRL; break; case 8: #if 0 rec->sph_fdef_flags |= SPH_FDEF_TYPEMAN_DIAGENDCTRL; exc->face->sph_found_func_flags |= SPH_FDEF_TYPEMAN_DIAGENDCTRL; #endif break; } opcode_pointer[i] = 0; } } else opcode_pointer[i] = 0; } /* Set sph_compatibility_mode only when deltas are detected */ exc->face->sph_compatibility_mode = ( ( exc->face->sph_found_func_flags & SPH_FDEF_INLINE_DELTA_1 ) | ( exc->face->sph_found_func_flags & SPH_FDEF_INLINE_DELTA_2 ) ); } #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ switch ( exc->opcode ) { case 0x89: /* IDEF */ case 0x2C: /* FDEF */ exc->error = FT_THROW( Nested_DEFS ); return; case 0x2D: /* ENDF */ rec->end = exc->IP; return; } } }
CWE-476
10,596
17,106
266807988989498600292908796880923142358
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_FLIPOFF( TT_ExecContext exc ) { exc->GS.auto_flip = FALSE; }
CWE-476
10,597
17,107
65844659379145838371895914640835257504
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_FLIPON( TT_ExecContext exc ) { exc->GS.auto_flip = TRUE; }
CWE-476
10,598
17,108
25486773730161921408235578250324246688
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_FLIPPT( TT_ExecContext exc ) { FT_UShort point; #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL /* See `ttinterp.h' for details on backward compatibility mode. */ if ( SUBPIXEL_HINTING_MINIMAL && exc->backward_compatibility && exc->iupx_called && exc->iupy_called ) goto Fail; #endif if ( exc->top < exc->GS.loop ) { if ( exc->pedantic_hinting ) exc->error = FT_THROW( Too_Few_Arguments ); goto Fail; } while ( exc->GS.loop > 0 ) { exc->args--; point = (FT_UShort)exc->stack[exc->args]; if ( BOUNDS( point, exc->pts.n_points ) ) { if ( exc->pedantic_hinting ) { exc->error = FT_THROW( Invalid_Reference ); return; } } else exc->pts.tags[point] ^= FT_CURVE_TAG_ON; exc->GS.loop--; } Fail: exc->GS.loop = 1; exc->new_top = exc->args; }
CWE-476
10,599
17,109
41002889435572193249509660790847333350
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_FLIPRGOFF( TT_ExecContext exc, FT_Long* args ) { FT_UShort I, K, L; #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL /* See `ttinterp.h' for details on backward compatibility mode. */ if ( SUBPIXEL_HINTING_MINIMAL && exc->backward_compatibility && exc->iupx_called && exc->iupy_called ) return; #endif K = (FT_UShort)args[1]; L = (FT_UShort)args[0]; if ( BOUNDS( K, exc->pts.n_points ) || BOUNDS( L, exc->pts.n_points ) ) { if ( exc->pedantic_hinting ) exc->error = FT_THROW( Invalid_Reference ); return; } for ( I = L; I <= K; I++ ) exc->pts.tags[I] &= ~FT_CURVE_TAG_ON; }
CWE-476
10,600
17,110
41814900447236827581947871719982886672
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_FLOOR( FT_Long* args ) { args[0] = FT_PIX_FLOOR( args[0] ); }
CWE-476
10,602
17,111
233682807784067453272265159370511067042
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_GC( TT_ExecContext exc, FT_Long* args ) { FT_ULong L; FT_F26Dot6 R; L = (FT_ULong)args[0]; if ( BOUNDSL( L, exc->zp2.n_points ) ) { if ( exc->pedantic_hinting ) exc->error = FT_THROW( Invalid_Reference ); R = 0; } else { if ( exc->opcode & 1 ) R = FAST_DUALPROJ( &exc->zp2.org[L] ); else R = FAST_PROJECT( &exc->zp2.cur[L] ); } args[0] = R; }
CWE-476
10,603
17,112
119096808270390274123746252169081459852
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_GETDATA( FT_Long* args ) { args[0] = 17; }
CWE-476
10,604
17,113
327580522189460911688891351516610534007
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_GETINFO( TT_ExecContext exc, FT_Long* args ) { FT_Long K; TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( exc->face ); K = 0; #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY /********************************/ /* RASTERIZER VERSION */ /* Selector Bit: 0 */ /* Return Bit(s): 0-7 */ /* */ if ( SUBPIXEL_HINTING_INFINALITY && ( args[0] & 1 ) != 0 && exc->subpixel_hinting ) { if ( exc->ignore_x_mode ) { /* if in ClearType backward compatibility mode, */ /* we sometimes change the TrueType version dynamically */ K = exc->rasterizer_version; FT_TRACE6(( "Setting rasterizer version %d\n", exc->rasterizer_version )); } else K = TT_INTERPRETER_VERSION_38; } else #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ if ( ( args[0] & 1 ) != 0 ) K = driver->interpreter_version; /********************************/ /* GLYPH ROTATED */ /* Selector Bit: 1 */ /* Return Bit(s): 8 */ /* */ if ( ( args[0] & 2 ) != 0 && exc->tt_metrics.rotated ) K |= 1 << 8; /********************************/ /* GLYPH STRETCHED */ /* Selector Bit: 2 */ /* Return Bit(s): 9 */ /* */ if ( ( args[0] & 4 ) != 0 && exc->tt_metrics.stretched ) K |= 1 << 9; #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT /********************************/ /* VARIATION GLYPH */ /* Selector Bit: 3 */ /* Return Bit(s): 10 */ /* */ /* XXX: UNDOCUMENTED! */ if ( (args[0] & 8 ) != 0 && exc->face->blend ) K |= 1 << 10; #endif /********************************/ /* BI-LEVEL HINTING AND */ /* GRAYSCALE RENDERING */ /* Selector Bit: 5 */ /* Return Bit(s): 12 */ /* */ if ( ( args[0] & 32 ) != 0 && exc->grayscale ) K |= 1 << 12; #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL /* Toggle the following flags only outside of monochrome mode. */ /* Otherwise, instructions may behave weirdly and rendering results */ /* may differ between v35 and v40 mode, e.g., in `Times New Roman */ /* Bold Italic'. */ if ( SUBPIXEL_HINTING_MINIMAL && exc->subpixel_hinting_lean ) { /********************************/ /* HINTING FOR SUBPIXEL */ /* Selector Bit: 6 */ /* Return Bit(s): 13 */ /* */ /* v40 does subpixel hinting by default. */ if ( ( args[0] & 64 ) != 0 ) K |= 1 << 13; /********************************/ /* VERTICAL LCD SUBPIXELS? */ /* Selector Bit: 8 */ /* Return Bit(s): 15 */ /* */ if ( ( args[0] & 256 ) != 0 && exc->vertical_lcd_lean ) K |= 1 << 15; /********************************/ /* SUBPIXEL POSITIONED? */ /* Selector Bit: 10 */ /* Return Bit(s): 17 */ /* */ /* XXX: FreeType supports it, dependent on what client does? */ if ( ( args[0] & 1024 ) != 0 ) K |= 1 << 17; /********************************/ /* SYMMETRICAL SMOOTHING */ /* Selector Bit: 11 */ /* Return Bit(s): 18 */ /* */ /* The only smoothing method FreeType supports unless someone sets */ /* FT_LOAD_TARGET_MONO. */ if ( ( args[0] & 2048 ) != 0 && exc->subpixel_hinting_lean ) K |= 1 << 18; /********************************/ /* CLEARTYPE HINTING AND */ /* GRAYSCALE RENDERING */ /* Selector Bit: 12 */ /* Return Bit(s): 19 */ /* */ /* Grayscale rendering is what FreeType does anyway unless someone */ /* sets FT_LOAD_TARGET_MONO or FT_LOAD_TARGET_LCD(_V) */ if ( ( args[0] & 4096 ) != 0 && exc->grayscale_cleartype ) K |= 1 << 19; } #endif #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY if ( SUBPIXEL_HINTING_INFINALITY && exc->rasterizer_version >= TT_INTERPRETER_VERSION_35 ) { if ( exc->rasterizer_version >= 37 ) { /********************************/ /* HINTING FOR SUBPIXEL */ /* Selector Bit: 6 */ /* Return Bit(s): 13 */ /* */ if ( ( args[0] & 64 ) != 0 && exc->subpixel_hinting ) K |= 1 << 13; /********************************/ /* COMPATIBLE WIDTHS ENABLED */ /* Selector Bit: 7 */ /* Return Bit(s): 14 */ /* */ /* Functionality still needs to be added */ if ( ( args[0] & 128 ) != 0 && exc->compatible_widths ) K |= 1 << 14; /********************************/ /* VERTICAL LCD SUBPIXELS? */ /* Selector Bit: 8 */ /* Return Bit(s): 15 */ /* */ /* Functionality still needs to be added */ if ( ( args[0] & 256 ) != 0 && exc->vertical_lcd ) K |= 1 << 15; /********************************/ /* HINTING FOR BGR? */ /* Selector Bit: 9 */ /* Return Bit(s): 16 */ /* */ /* Functionality still needs to be added */ if ( ( args[0] & 512 ) != 0 && exc->bgr ) K |= 1 << 16; if ( exc->rasterizer_version >= 38 ) { /********************************/ /* SUBPIXEL POSITIONED? */ /* Selector Bit: 10 */ /* Return Bit(s): 17 */ /* */ /* Functionality still needs to be added */ if ( ( args[0] & 1024 ) != 0 && exc->subpixel_positioned ) K |= 1 << 17; /********************************/ /* SYMMETRICAL SMOOTHING */ /* Selector Bit: 11 */ /* Return Bit(s): 18 */ /* */ /* Functionality still needs to be added */ if ( ( args[0] & 2048 ) != 0 && exc->symmetrical_smoothing ) K |= 1 << 18; /********************************/ /* GRAY CLEARTYPE */ /* Selector Bit: 12 */ /* Return Bit(s): 19 */ /* */ /* Functionality still needs to be added */ if ( ( args[0] & 4096 ) != 0 && exc->gray_cleartype ) K |= 1 << 19; } } } #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ args[0] = K; }
CWE-476
10,605
17,114
171734539038214794199873360758047439791
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_GFV( TT_ExecContext exc, FT_Long* args ) { args[0] = exc->GS.freeVector.x; args[1] = exc->GS.freeVector.y; }
CWE-476
10,606
17,115
179938476094438345876264746929901732787
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_GPV( TT_ExecContext exc, FT_Long* args ) { args[0] = exc->GS.projVector.x; args[1] = exc->GS.projVector.y; }
CWE-476
10,607
17,116
277520929025288802786068359719188469013
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_GT( FT_Long* args ) { args[0] = ( args[0] > args[1] ); }
CWE-476
10,608
17,117
4340326390282921601417932596861796130
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_GTEQ( FT_Long* args ) { args[0] = ( args[0] >= args[1] ); }
CWE-476
10,609
17,118
96760560949111189235090468044353221524
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_IDEF( TT_ExecContext exc, FT_Long* args ) { TT_DefRecord* def; TT_DefRecord* limit; /* we enable IDEF only in `prep' or `fpgm' */ if ( exc->curRange == tt_coderange_glyph ) { exc->error = FT_THROW( DEF_In_Glyf_Bytecode ); return; } /* First of all, look for the same function in our table */ def = exc->IDefs; limit = def + exc->numIDefs; for ( ; def < limit; def++ ) if ( def->opc == (FT_ULong)args[0] ) break; if ( def == limit ) { /* check that there is enough room for a new instruction */ if ( exc->numIDefs >= exc->maxIDefs ) { exc->error = FT_THROW( Too_Many_Instruction_Defs ); return; } exc->numIDefs++; } /* opcode must be unsigned 8-bit integer */ if ( 0 > args[0] || args[0] > 0x00FF ) { exc->error = FT_THROW( Too_Many_Instruction_Defs ); return; } def->opc = (FT_Byte)args[0]; def->start = exc->IP + 1; def->range = exc->curRange; def->active = TRUE; if ( (FT_ULong)args[0] > exc->maxIns ) exc->maxIns = (FT_Byte)args[0]; /* Now skip the whole function definition. */ /* We don't allow nested IDEFs & FDEFs. */ while ( SkipCode( exc ) == SUCCESS ) { switch ( exc->opcode ) { case 0x89: /* IDEF */ case 0x2C: /* FDEF */ exc->error = FT_THROW( Nested_DEFS ); return; case 0x2D: /* ENDF */ def->end = exc->IP; return; } } }
CWE-476
10,611
17,119
84109058904969778790108493749217294086
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_IF( TT_ExecContext exc, FT_Long* args ) { FT_Int nIfs; FT_Bool Out; if ( args[0] != 0 ) return; nIfs = 1; Out = 0; do { if ( SkipCode( exc ) == FAILURE ) return; switch ( exc->opcode ) { case 0x58: /* IF */ nIfs++; break; case 0x1B: /* ELSE */ Out = FT_BOOL( nIfs == 1 ); break; case 0x59: /* EIF */ nIfs--; Out = FT_BOOL( nIfs == 0 ); break; } } while ( Out == 0 ); }
CWE-476
10,612
17,120
105966260508515447660882975625566939016
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_INSTCTRL( TT_ExecContext exc, FT_Long* args ) { FT_ULong K, L, Kf; K = (FT_ULong)args[1]; L = (FT_ULong)args[0]; /* selector values cannot be `OR'ed; */ /* they are indices starting with index 1, not flags */ if ( K < 1 || K > 3 ) { if ( exc->pedantic_hinting ) exc->error = FT_THROW( Invalid_Reference ); return; } /* convert index to flag value */ Kf = 1 << ( K - 1 ); if ( L != 0 ) { /* arguments to selectors look like flag values */ if ( L != Kf ) { if ( exc->pedantic_hinting ) exc->error = FT_THROW( Invalid_Reference ); return; } } exc->GS.instruct_control &= ~(FT_Byte)Kf; exc->GS.instruct_control |= (FT_Byte)L; if ( K == 3 ) { #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY /* INSTCTRL modifying flag 3 also has an effect */ /* outside of the CVT program */ if ( SUBPIXEL_HINTING_INFINALITY ) exc->ignore_x_mode = FT_BOOL( L == 4 ); #endif #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL /* Native ClearType fonts sign a waiver that turns off all backward */ /* compatibility hacks and lets them program points to the grid like */ /* it's 1996. They might sign a waiver for just one glyph, though. */ if ( SUBPIXEL_HINTING_MINIMAL ) exc->backward_compatibility = !FT_BOOL( L == 4 ); #endif } }
CWE-476
10,613
17,121
11003091600606578172678328163540705034
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_IP( TT_ExecContext exc ) { FT_F26Dot6 old_range, cur_range; FT_Vector* orus_base; FT_Vector* cur_base; FT_Int twilight; if ( exc->top < exc->GS.loop ) { if ( exc->pedantic_hinting ) exc->error = FT_THROW( Invalid_Reference ); goto Fail; } /* * We need to deal in a special way with the twilight zone. * Otherwise, by definition, the value of exc->twilight.orus[n] is (0,0), * for every n. */ twilight = ( exc->GS.gep0 == 0 || exc->GS.gep1 == 0 || exc->GS.gep2 == 0 ); if ( BOUNDS( exc->GS.rp1, exc->zp0.n_points ) ) { if ( exc->pedantic_hinting ) exc->error = FT_THROW( Invalid_Reference ); goto Fail; } if ( twilight ) orus_base = &exc->zp0.org[exc->GS.rp1]; else orus_base = &exc->zp0.orus[exc->GS.rp1]; cur_base = &exc->zp0.cur[exc->GS.rp1]; /* XXX: There are some glyphs in some braindead but popular */ /* fonts out there (e.g. [aeu]grave in monotype.ttf) */ /* calling IP[] with bad values of rp[12]. */ /* Do something sane when this odd thing happens. */ if ( BOUNDS( exc->GS.rp1, exc->zp0.n_points ) || BOUNDS( exc->GS.rp2, exc->zp1.n_points ) ) { old_range = 0; cur_range = 0; } else { if ( twilight ) old_range = DUALPROJ( &exc->zp1.org[exc->GS.rp2], orus_base ); else if ( exc->metrics.x_scale == exc->metrics.y_scale ) old_range = DUALPROJ( &exc->zp1.orus[exc->GS.rp2], orus_base ); else { FT_Vector vec; vec.x = FT_MulFix( SUB_LONG( exc->zp1.orus[exc->GS.rp2].x, orus_base->x ), exc->metrics.x_scale ); vec.y = FT_MulFix( SUB_LONG( exc->zp1.orus[exc->GS.rp2].y, orus_base->y ), exc->metrics.y_scale ); old_range = FAST_DUALPROJ( &vec ); } cur_range = PROJECT( &exc->zp1.cur[exc->GS.rp2], cur_base ); } for ( ; exc->GS.loop > 0; exc->GS.loop-- ) { FT_UInt point = (FT_UInt)exc->stack[--exc->args]; FT_F26Dot6 org_dist, cur_dist, new_dist; /* check point bounds */ if ( BOUNDS( point, exc->zp2.n_points ) ) { if ( exc->pedantic_hinting ) { exc->error = FT_THROW( Invalid_Reference ); return; } continue; } if ( twilight ) org_dist = DUALPROJ( &exc->zp2.org[point], orus_base ); else if ( exc->metrics.x_scale == exc->metrics.y_scale ) org_dist = DUALPROJ( &exc->zp2.orus[point], orus_base ); else { FT_Vector vec; vec.x = FT_MulFix( SUB_LONG( exc->zp2.orus[point].x, orus_base->x ), exc->metrics.x_scale ); vec.y = FT_MulFix( SUB_LONG( exc->zp2.orus[point].y, orus_base->y ), exc->metrics.y_scale ); org_dist = FAST_DUALPROJ( &vec ); } cur_dist = PROJECT( &exc->zp2.cur[point], cur_base ); if ( org_dist ) { if ( old_range ) new_dist = FT_MulDiv( org_dist, cur_range, old_range ); else { /* This is the same as what MS does for the invalid case: */ /* */ /* delta = (Original_Pt - Original_RP1) - */ /* (Current_Pt - Current_RP1) ; */ /* */ /* In FreeType speak: */ /* */ /* delta = org_dist - cur_dist . */ /* */ /* We move `point' by `new_dist - cur_dist' after leaving */ /* this block, thus we have */ /* */ /* new_dist - cur_dist = delta , */ /* new_dist - cur_dist = org_dist - cur_dist , */ /* new_dist = org_dist . */ new_dist = org_dist; } } else new_dist = 0; exc->func_move( exc, &exc->zp2, (FT_UShort)point, SUB_LONG( new_dist, cur_dist ) ); } Fail: exc->GS.loop = 1; exc->new_top = exc->args; }
CWE-476
10,614
17,122
117953151236917310475074918077102683760
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_ISECT( TT_ExecContext exc, FT_Long* args ) { FT_UShort point, a0, a1, b0, b1; FT_F26Dot6 discriminant, dotproduct; FT_F26Dot6 dx, dy, dax, day, dbx, dby; FT_F26Dot6 val; FT_Vector R; point = (FT_UShort)args[0]; a0 = (FT_UShort)args[1]; a1 = (FT_UShort)args[2]; b0 = (FT_UShort)args[3]; b1 = (FT_UShort)args[4]; if ( BOUNDS( b0, exc->zp0.n_points ) || BOUNDS( b1, exc->zp0.n_points ) || BOUNDS( a0, exc->zp1.n_points ) || BOUNDS( a1, exc->zp1.n_points ) || BOUNDS( point, exc->zp2.n_points ) ) { if ( exc->pedantic_hinting ) exc->error = FT_THROW( Invalid_Reference ); return; } /* Cramer's rule */ dbx = SUB_LONG( exc->zp0.cur[b1].x, exc->zp0.cur[b0].x ); dby = SUB_LONG( exc->zp0.cur[b1].y, exc->zp0.cur[b0].y ); dax = SUB_LONG( exc->zp1.cur[a1].x, exc->zp1.cur[a0].x ); day = SUB_LONG( exc->zp1.cur[a1].y, exc->zp1.cur[a0].y ); dx = SUB_LONG( exc->zp0.cur[b0].x, exc->zp1.cur[a0].x ); dy = SUB_LONG( exc->zp0.cur[b0].y, exc->zp1.cur[a0].y ); discriminant = ADD_LONG( FT_MulDiv( dax, NEG_LONG( dby ), 0x40 ), FT_MulDiv( day, dbx, 0x40 ) ); dotproduct = ADD_LONG( FT_MulDiv( dax, dbx, 0x40 ), FT_MulDiv( day, dby, 0x40 ) ); /* The discriminant above is actually a cross product of vectors */ /* da and db. Together with the dot product, they can be used as */ /* surrogates for sine and cosine of the angle between the vectors. */ /* Indeed, */ /* dotproduct = |da||db|cos(angle) */ /* discriminant = |da||db|sin(angle) . */ /* We use these equations to reject grazing intersections by */ /* thresholding abs(tan(angle)) at 1/19, corresponding to 3 degrees. */ if ( MUL_LONG( 19, FT_ABS( discriminant ) ) > FT_ABS( dotproduct ) ) { val = ADD_LONG( FT_MulDiv( dx, NEG_LONG( dby ), 0x40 ), FT_MulDiv( dy, dbx, 0x40 ) ); R.x = FT_MulDiv( val, dax, discriminant ); R.y = FT_MulDiv( val, day, discriminant ); /* XXX: Block in backward_compatibility and/or post-IUP? */ exc->zp2.cur[point].x = ADD_LONG( exc->zp1.cur[a0].x, R.x ); exc->zp2.cur[point].y = ADD_LONG( exc->zp1.cur[a0].y, R.y ); } else { /* else, take the middle of the middles of A and B */ /* XXX: Block in backward_compatibility and/or post-IUP? */ exc->zp2.cur[point].x = ADD_LONG( ADD_LONG( exc->zp1.cur[a0].x, exc->zp1.cur[a1].x ), ADD_LONG( exc->zp0.cur[b0].x, exc->zp0.cur[b1].x ) ) / 4; exc->zp2.cur[point].y = ADD_LONG( ADD_LONG( exc->zp1.cur[a0].y, exc->zp1.cur[a1].y ), ADD_LONG( exc->zp0.cur[b0].y, exc->zp0.cur[b1].y ) ) / 4; } exc->zp2.tags[point] |= FT_CURVE_TAG_TOUCH_BOTH; }
CWE-476
10,615
17,123
198294489833063919735232265536063749193
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_IUP( TT_ExecContext exc ) { IUP_WorkerRec V; FT_Byte mask; FT_UInt first_point; /* first point of contour */ FT_UInt end_point; /* end point (last+1) of contour */ FT_UInt first_touched; /* first touched point in contour */ FT_UInt cur_touched; /* current touched point in contour */ FT_UInt point; /* current point */ FT_Short contour; /* current contour */ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL /* See `ttinterp.h' for details on backward compatibility mode. */ /* Allow IUP until it has been called on both axes. Immediately */ /* return on subsequent ones. */ if ( SUBPIXEL_HINTING_MINIMAL && exc->backward_compatibility ) { if ( exc->iupx_called && exc->iupy_called ) return; if ( exc->opcode & 1 ) exc->iupx_called = TRUE; else exc->iupy_called = TRUE; } #endif /* ignore empty outlines */ if ( exc->pts.n_contours == 0 ) return; if ( exc->opcode & 1 ) { mask = FT_CURVE_TAG_TOUCH_X; V.orgs = exc->pts.org; V.curs = exc->pts.cur; V.orus = exc->pts.orus; } else { mask = FT_CURVE_TAG_TOUCH_Y; V.orgs = (FT_Vector*)( (FT_Pos*)exc->pts.org + 1 ); V.curs = (FT_Vector*)( (FT_Pos*)exc->pts.cur + 1 ); V.orus = (FT_Vector*)( (FT_Pos*)exc->pts.orus + 1 ); } V.max_points = exc->pts.n_points; contour = 0; point = 0; #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY if ( SUBPIXEL_HINTING_INFINALITY && exc->ignore_x_mode ) { exc->iup_called = TRUE; if ( exc->sph_tweak_flags & SPH_TWEAK_SKIP_IUP ) return; } #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ do { end_point = exc->pts.contours[contour] - exc->pts.first_point; first_point = point; if ( BOUNDS( end_point, exc->pts.n_points ) ) end_point = exc->pts.n_points - 1; while ( point <= end_point && ( exc->pts.tags[point] & mask ) == 0 ) point++; if ( point <= end_point ) { first_touched = point; cur_touched = point; point++; while ( point <= end_point ) { if ( ( exc->pts.tags[point] & mask ) != 0 ) { _iup_worker_interpolate( &V, cur_touched + 1, point - 1, cur_touched, point ); cur_touched = point; } point++; } if ( cur_touched == first_touched ) _iup_worker_shift( &V, first_point, end_point, cur_touched ); else { _iup_worker_interpolate( &V, (FT_UShort)( cur_touched + 1 ), end_point, cur_touched, first_touched ); if ( first_touched > 0 ) _iup_worker_interpolate( &V, first_point, first_touched - 1, cur_touched, first_touched ); } } contour++; } while ( contour < exc->pts.n_contours ); }
CWE-476
10,616
17,124
5875856100045480890527797680786437434
null
null
null
savannah
29c759284e305ec428703c9a5831d0b1fc3497ef
0
Ins_JMPR( TT_ExecContext exc, FT_Long* args ) { if ( args[0] == 0 && exc->args == 0 ) { exc->error = FT_THROW( Bad_Argument ); return; } exc->IP += args[0]; if ( exc->IP < 0 || ( exc->callTop > 0 && exc->IP > exc->callStack[exc->callTop - 1].Def->end ) ) { exc->error = FT_THROW( Bad_Argument ); return; } exc->step_ins = FALSE; if ( args[0] < 0 ) { if ( ++exc->neg_jump_counter > exc->neg_jump_counter_max ) exc->error = FT_THROW( Execution_Too_Long ); } }
CWE-476
10,617
17,125
35945401209936136069586762549640854587
null
null
null