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
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_RCVT( INS_ARG ) { int index; if ( BOUNDS( args[0], CUR.cvtSize ) ) { CUR.error = TT_Err_Invalid_Reference; return; } index=args[0]; args[0] = CUR_Func_read_cvt( index ); DBG_PRINT3(" cvt[%d]%d:%d", index, CUR.cvt[index], args[0]); }
CWE-125
5,428
14,474
150080993396064851438231092927522452653
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_RDTG( INS_ARG ) { (void)args; CUR.GS.round_state = TT_Round_Down_To_Grid; CUR.func_round = (TRound_Function)Round_Down_To_Grid; }
CWE-125
5,429
14,475
183701574697316271015835079204281837231
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_ROFF( INS_ARG ) { (void)args; CUR.GS.round_state = TT_Round_Off; CUR.func_round = (TRound_Function)Round_None; }
CWE-125
5,430
14,476
334946627506749131030250712598722557117
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_ROLL( INS_ARG ) { Long A, B, C; (void)exc; A = args[2]; B = args[1]; C = args[0]; args[2] = C; args[1] = A; args[0] = B; }
CWE-125
5,431
14,477
327786844025455440721457073544004275598
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_ROUND( INS_ARG ) { args[0] = CUR_Func_round( args[0], CUR.metrics.compensations[CUR.opcode - 0x68] ); }
CWE-125
5,432
14,478
77865024610116154339125496998161825199
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_RS( INS_ARG ) { if ( BOUNDS( args[0], CUR.storeSize ) ) { CUR.error = TT_Err_Invalid_Reference; return; } args[0] = CUR.storage[args[0]]; }
CWE-125
5,433
14,479
233979957869279790075861261678834663143
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_RTDG( INS_ARG ) { (void)args; CUR.GS.round_state = TT_Round_To_Double_Grid; CUR.func_round = (TRound_Function)Round_To_Double_Grid; }
CWE-125
5,434
14,480
79421499265012715278418737950188073821
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_RTG( INS_ARG ) { (void)args; CUR.GS.round_state = TT_Round_To_Grid; CUR.func_round = (TRound_Function)Round_To_Grid; }
CWE-125
5,435
14,481
23616316868867262428269617917386082487
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_RTHG( INS_ARG ) { (void)args; CUR.GS.round_state = TT_Round_To_Half_Grid; CUR.func_round = (TRound_Function)Round_To_Half_Grid; }
CWE-125
5,436
14,482
221886666304854619504529922645325771916
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_RUTG( INS_ARG ) { (void)args; CUR.GS.round_state = TT_Round_Up_To_Grid; CUR.func_round = (TRound_Function)Round_Up_To_Grid; }
CWE-125
5,437
14,483
67839837456225883763552301634740989640
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_S45ROUND( INS_ARG ) { SET_SuperRound( 0x2D41L, args[0] ); CUR.GS.round_state = TT_Round_Super_45; CUR.func_round = (TRound_Function)Round_Super_45; }
CWE-125
5,438
14,484
165971014692595375181628370039002896638
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_SANGW( INS_ARG ) { (void)exc; (void)args; /* instruction not supported anymore */ }
CWE-125
5,439
14,485
297672668069894888628844989254780043157
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_SCANTYPE( INS_ARG ) { /* For compatibility with future enhancements, */ /* we must ignore new modes */ if ( args[0] >= 0 && args[0] <= 5 ) { if ( args[0] == 3 ) args[0] = 2; CUR.GS.scan_type = (Int)args[0]; } }
CWE-125
5,441
14,486
72361679573605602989846885089829790073
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_SCFS( INS_ARG ) { Long K; Int L; L = (Int)args[0]; if ( BOUNDS( args[0], CUR.zp2.n_points ) ) { CUR.error = TT_Err_Invalid_Reference; return; } K = CUR_Func_project( CUR.zp2.cur_x[L], CUR.zp2.cur_y[L] ); CUR_Func_move( &CUR.zp2, L, args[1] - K ); /* not part of the specs, but here for safety */ if ( CUR.GS.gep2 == 0 ) { CUR.zp2.org_x[L] = CUR.zp2.cur_x[L]; CUR.zp2.org_y[L] = CUR.zp2.cur_y[L]; } }
CWE-125
5,442
14,487
125824360844398906812547039329721979546
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_SCVTCI( INS_ARG ) { CUR.GS.control_value_cutin = (TT_F26Dot6)args[0]; }
CWE-125
5,443
14,488
82094912780757191668755650949449989400
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_SDB( INS_ARG ) { CUR.GS.delta_base = (Int)args[0]; }
CWE-125
5,444
14,489
325461345102454905262429960215727331855
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_SDS( INS_ARG ) { CUR.GS.delta_shift = (Int)args[0]; }
CWE-125
5,446
14,490
150472138688008845800163094283439082390
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_SFVFS( INS_ARG ) { Short S; Long X, Y; /* Only use low 16bits, then sign extend */ S = (Short)args[1]; Y = (Long)S; S = (Short)args[0]; X = S; if ( NORMalize( X, Y, &CUR.GS.freeVector ) == FAILURE ) return; COMPUTE_Funcs(); }
CWE-125
5,447
14,491
56737473063722798976279245602562459695
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_SFVTL( INS_ARG ) { if ( INS_SxVTL( (Int)(args[1]), (Int)(args[0]), CUR.opcode, &CUR.GS.freeVector) == FAILURE ) return; COMPUTE_Funcs(); }
CWE-125
5,448
14,492
113479451416533656822486109851992297360
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_SFVTPV( INS_ARG ) { (void)args; CUR.GS.freeVector = CUR.GS.projVector; COMPUTE_Funcs(); }
CWE-125
5,449
14,493
215086706333306030276367118446069937672
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_SHC( INS_ARG ) { TGlyph_Zone zp; Int refp; TT_F26Dot6 dx, dy; Long contour, i; Int first_point, last_point; contour = args[0]; if ( BOUNDS( args[0], CUR.pts.n_contours ) ) { #if 0 /* A workaround for the Ghostscript bug 688501. * Ported from FreeType 2 */ CUR.error = TT_Err_Invalid_Reference; #endif return; } if ( COMPUTE_Point_Displacement( &dx, &dy, &zp, &refp ) ) return; if ( contour == 0 ) first_point = 0; else first_point = CUR.pts.contours[contour-1] + 1; last_point = CUR.pts.contours[contour]; /* undocumented: SHC doesn't touch the points */ for ( i = first_point; i <= last_point; i++ ) { if ( zp.cur_x != CUR.zp2.cur_x || refp != i ) MOVE_Zp2_Point( i, dx, dy, FALSE ); } }
CWE-125
5,450
14,494
11824281627557021150631975093070923066
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_SHP( INS_ARG ) { TGlyph_Zone zp; Int refp; TT_F26Dot6 dx, dy; Long point; (void)args; if ( CUR.top < CUR.GS.loop ) { CUR.error = TT_Err_Invalid_Reference; return; } if ( COMPUTE_Point_Displacement( &dx, &dy, &zp, &refp ) ) return; while ( CUR.GS.loop > 0 ) { CUR.args--; point = CUR.stack[CUR.args]; if ( BOUNDS( point, CUR.zp2.n_points ) ) { CUR.error = TT_Err_Invalid_Reference; return; } /* undocumented: SHP touches the points */ MOVE_Zp2_Point( point, dx, dy, TRUE ); CUR.GS.loop--; } CUR.GS.loop = 1; CUR.new_top = CUR.args; }
CWE-125
5,451
14,495
122952730393206379225464943347742659564
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_SHZ( INS_ARG ) { TGlyph_Zone zp; Int refp; TT_F26Dot6 dx, dy; Int last_point; Long i; if ( BOUNDS( args[0], 2 ) ) { CUR.error = TT_Err_Invalid_Reference; return; } if ( COMPUTE_Point_Displacement( &dx, &dy, &zp, &refp ) ) return; last_point = zp.n_points - 1; /* undocumented: SHZ doesn't touch the points */ for ( i = 0; i <= last_point; i++ ) { if ( zp.cur_x != CUR.zp2.cur_x || refp != i ) MOVE_Zp2_Point( i, dx, dy, FALSE ); } }
CWE-125
5,453
14,496
192395569149677911197276923318015437638
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_SLOOP( INS_ARG ) { CUR.GS.loop = args[0]; }
CWE-125
5,454
14,497
122063365760978356609707070502994945795
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_SMD( INS_ARG ) { CUR.GS.minimum_distance = args[0]; }
CWE-125
5,455
14,498
248990670230071775356824742249813852014
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_SPVFS( INS_ARG ) { Short S; Long X, Y; /* Only use low 16bits, then sign extend */ S = (Short)args[1]; Y = (Long)S; S = (Short)args[0]; X = (Long)S; if ( NORMalize( X, Y, &CUR.GS.projVector ) == FAILURE ) return; CUR.GS.dualVector = CUR.GS.projVector; COMPUTE_Funcs(); }
CWE-125
5,456
14,499
134728324631302930940491613065963289720
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_SPVTCA( INS_ARG ) { Short A, B; (void)args; if ( CUR.opcode & 1 ) A = 0x4000; else A = 0; B = A ^ 0x4000; CUR.GS.projVector.x = A; CUR.GS.dualVector.x = A; CUR.GS.projVector.y = B; CUR.GS.dualVector.y = B; COMPUTE_Funcs(); }
CWE-125
5,457
14,500
337816332542432282310053321387279622679
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_SPVTL( INS_ARG ) { if ( INS_SxVTL( args[1], args[0], CUR.opcode, &CUR.GS.projVector) == FAILURE ) return; CUR.GS.dualVector = CUR.GS.projVector; COMPUTE_Funcs(); }
CWE-125
5,458
14,501
115716731441054518877369577000203876032
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_SROUND( INS_ARG ) { SET_SuperRound( 0x4000L, args[0] ); CUR.GS.round_state = TT_Round_Super; CUR.func_round = (TRound_Function)Round_Super; }
CWE-125
5,459
14,502
157752851896101591680679232981521516505
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_SRP0( INS_ARG ) { CUR.GS.rp0 = (Int)(args[0]); }
CWE-125
5,460
14,503
35797484914510574754262590860690884969
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_SRP1( INS_ARG ) { CUR.GS.rp1 = (Int)(args[0]); }
CWE-125
5,461
14,504
177765095204213126000643525975990667951
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_SSW( INS_ARG ) { /* XXX : Undocumented or bug in the Windows engine ? */ /* */ /* It seems that the value that is read here is */ /* expressed in 16.16 format, rather than in */ /* font units.. */ /* */ CUR.GS.single_width_value = (TT_F26Dot6)(args[0] >> 10); }
CWE-125
5,463
14,505
84497461838742688372760705309075101317
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_SSWCI( INS_ARG ) { CUR.GS.single_width_cutin = (TT_F26Dot6)args[0]; }
CWE-125
5,464
14,506
73075151058827521545360492836144792152
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_SUB( INS_ARG ) { (void)exc; args[0] -= args[1]; }
CWE-125
5,465
14,507
1427983934725477083893092732420426938
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_SVTCA( INS_ARG ) { Short A, B; (void)args; if ( CUR.opcode & 1 ) A = 0x4000; else A = 0; B = A ^ 0x4000; CUR.GS.freeVector.x = A; CUR.GS.projVector.x = A; CUR.GS.dualVector.x = A; CUR.GS.freeVector.y = B; CUR.GS.projVector.y = B; CUR.GS.dualVector.y = B; COMPUTE_Funcs(); }
CWE-125
5,466
14,508
51921691021977904753414245864447809746
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_SWAP( INS_ARG ) { Long L; (void)exc; L = args[0]; args[0] = args[1]; args[1] = L; }
CWE-125
5,467
14,509
141730845609530722679666673484153427123
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_SZP0( INS_ARG ) { switch ( args[0] ) { case 0: CUR.zp0 = CUR.twilight; break; case 1: CUR.zp0 = CUR.pts; break; default: CUR.error = TT_Err_Invalid_Reference; return; break; } CUR.GS.gep0 = (Int)(args[0]); }
CWE-125
5,468
14,510
340044391453700824354074532492812411337
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_SZP1( INS_ARG ) { switch ( args[0] ) { case 0: CUR.zp1 = CUR.twilight; break; case 1: CUR.zp1 = CUR.pts; break; default: CUR.error = TT_Err_Invalid_Reference; return; } CUR.GS.gep1 = (Int)(args[0]); }
CWE-125
5,469
14,511
184455524780890732725735424697827202700
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_SZP2( INS_ARG ) { switch ( args[0] ) { case 0: CUR.zp2 = CUR.twilight; break; case 1: CUR.zp2 = CUR.pts; break; default: CUR.error = TT_Err_Invalid_Reference; return; } CUR.GS.gep2 = (Int)(args[0]); }
CWE-125
5,470
14,512
55322716244864984164104804744170614444
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_SZPS( INS_ARG ) { switch ( args[0] ) { case 0: CUR.zp0 = CUR.twilight; break; case 1: CUR.zp0 = CUR.pts; break; default: CUR.error = TT_Err_Invalid_Reference; return; } CUR.zp1 = CUR.zp0; CUR.zp2 = CUR.zp0; CUR.GS.gep0 = (Int)(args[0]); CUR.GS.gep1 = (Int)(args[0]); CUR.GS.gep2 = (Int)(args[0]); }
CWE-125
5,471
14,513
291558156183166237351329353701473189631
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static Bool Ins_SxVTL( EXEC_OPS Int aIdx1, Int aIdx2, Int aOpc, TT_UnitVector* Vec ) { Long A, B, C; if ( BOUNDS( aIdx1, CUR.zp2.n_points ) || BOUNDS( aIdx2, CUR.zp1.n_points ) ) { CUR.error = TT_Err_Invalid_Reference; return FAILURE; } A = CUR.zp1.cur_x[aIdx2] - CUR.zp2.cur_x[aIdx1]; B = CUR.zp1.cur_y[aIdx2] - CUR.zp2.cur_y[aIdx1]; if ( (aOpc & 1) != 0 ) { C = B; /* CounterClockwise rotation */ B = A; A = -C; } if ( NORMalize( A, B, Vec ) == FAILURE ) { /* When the vector is too small or zero! */ CUR.error = TT_Err_Ok; Vec->x = 0x4000; Vec->y = 0; } return SUCCESS; }
CWE-125
5,472
14,514
172555558480545489925566783816491143894
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_UNKNOWN( INS_ARG ) { /* Rewritten by igorm. */ Byte i; TDefRecord* def; PCallRecord call; # if 0 /* The condition below appears always false due to limited range of data type - skip it to quiet a compiler warning. */ if (CUR.opcode > sizeof(CUR.IDefPtr) / sizeof(CUR.IDefPtr[0])) { CUR.error = TT_Err_Invalid_Opcode; return; } # endif i = CUR.IDefPtr[(Byte)CUR.opcode]; if (i >= CUR.numIDefs) { CUR.error = TT_Err_Invalid_Opcode; return; } def = &CUR.IDefs[i]; if ( CUR.callTop >= CUR.callSize ) { CUR.error = TT_Err_Stack_Overflow; return; } call = CUR.callStack + CUR.callTop++; call->Caller_Range = CUR.curRange; call->Caller_IP = CUR.IP+1; call->Cur_Count = 1; call->Cur_Restart = def->Start; INS_Goto_CodeRange( def->Range, def->Start ); CUR.step_ins = FALSE; return; }
CWE-125
5,473
14,515
253855812325988976896551846480098757512
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_UTP( INS_ARG ) { Byte mask; if ( BOUNDS( args[0], CUR.zp0.n_points ) ) { CUR.error = TT_Err_Invalid_Reference; return; } mask = 0xFF; if ( CUR.GS.freeVector.x != 0 ) mask &= ~TT_Flag_Touched_X; if ( CUR.GS.freeVector.y != 0 ) mask &= ~TT_Flag_Touched_Y; CUR.zp0.touch[args[0]] &= mask; }
CWE-125
5,474
14,516
17911119131723685534550978276368111296
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_WCVTP( INS_ARG ) { if ( BOUNDS( args[0], CUR.cvtSize ) ) { CUR.error = TT_Err_Invalid_Reference; return; } CUR_Func_write_cvt( args[0], args[1] ); }
CWE-125
5,476
14,517
336567763828022937618161986731974805173
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Ins_WS( INS_ARG ) { if ( BOUNDS( args[0], CUR.storeSize ) ) { CUR.error = TT_Err_Invalid_Reference; return; } CUR.storage[args[0]] = args[1]; }
CWE-125
5,477
14,518
299050919620920996472666346829781801205
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Interp( Int p1, Int p2, Int ref1, Int ref2, struct LOC_Ins_IUP* LINK ) { Long i; TT_F26Dot6 x, x1, x2, d1, d2; if ( p1 > p2 ) return; x1 = LINK->orgs[ref1]; d1 = LINK->curs[ref1] - LINK->orgs[ref1]; x2 = LINK->orgs[ref2]; d2 = LINK->curs[ref2] - LINK->orgs[ref2]; if ( x1 == x2 ) { for ( i = p1; i <= p2; i++ ) { x = LINK->orgs[i]; if ( x <= x1 ) x += d1; else x += d2; LINK->curs[i] = x; } return; } if ( x1 < x2 ) { for ( i = p1; i <= p2; i++ ) { x = LINK->orgs[i]; if ( x <= x1 ) x += d1; else { if ( x >= x2 ) x += d2; else x = LINK->curs[ref1] + MulDiv_Round( x - x1, LINK->curs[ref2] - LINK->curs[ref1], x2 - x1 ); } LINK->curs[i] = x; } return; } /* x2 < x1 */ for ( i = p1; i <= p2; i++ ) { x = LINK->orgs[i]; if ( x <= x2 ) x += d2; else { if ( x >= x1 ) x += d1; else x = LINK->curs[ref1] + MulDiv_Round( x - x1, LINK->curs[ref2] - LINK->curs[ref1], x2 - x1 ); } LINK->curs[i] = x; } }
CWE-125
5,478
14,519
282277138227832875529985278601601057984
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Move_CVT( EXEC_OPS Int index, TT_F26Dot6 value ) { int ov=CUR.cvt[index]; (void)ov; /* Quiet compiler warning in release build. */ CUR.cvt[index] += value; DBG_PRINT3(" cvt[%d]%d:=%d", index, ov, CUR.cvt[index]); }
CWE-125
5,479
14,520
70010160248845526700691731572013000119
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Move_CVT_Stretched( EXEC_OPS Int index, TT_F26Dot6 value ) { int ov=CUR.cvt[index]; (void)ov; /* Quiet compiler warning in release build. */ CUR.cvt[index] += MulDiv_Round( value, 0x10000, CURRENT_Ratio() ); DBG_PRINT3(" cvt[%d]%d:=%d", index, ov, CUR.cvt[index]); }
CWE-125
5,480
14,521
41958524225093324238799237048022614375
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Move_Zp2_Point( EXEC_OPS Long point, TT_F26Dot6 dx, TT_F26Dot6 dy, Bool touch ) { if ( CUR.GS.freeVector.x != 0 ) { CUR.zp2.cur_x[point] += dx; if ( touch ) CUR.zp2.touch[point] |= TT_Flag_Touched_X; } if ( CUR.GS.freeVector.y != 0 ) { CUR.zp2.cur_y[point] += dy; if ( touch ) CUR.zp2.touch[point] |= TT_Flag_Touched_Y; } }
CWE-125
5,481
14,522
302862630406066807011718557862665593071
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static TT_F26Dot6 Norm( TT_F26Dot6 X, TT_F26Dot6 Y ) { Int64 T1, T2; MUL_64( X, X, T1 ); MUL_64( Y, Y, T2 ); ADD_64( T1, T2, T1 ); return (TT_F26Dot6)SQRT_64( T1 ); }
CWE-125
5,482
14,523
228065837502835296442022637036830598323
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static Bool Normalize( EXEC_OPS TT_F26Dot6 Vx, TT_F26Dot6 Vy, TT_UnitVector* R ) { TT_F26Dot6 W; Bool S1, S2; if ( ABS( Vx ) < 0x10000L && ABS( Vy ) < 0x10000L ) { Vx *= 0x100; Vy *= 0x100; W = Norm( Vx, Vy ); if ( W == 0 ) { /* XXX : Undocumented. It seems that it's possible to try */ /* to normalize the vector (0,0). Return immediately */ return SUCCESS; } R->x = (TT_F2Dot14)MulDiv_Round( Vx, 0x4000L, W ); R->y = (TT_F2Dot14)MulDiv_Round( Vy, 0x4000L, W ); return SUCCESS; } W = Norm( Vx, Vy ); if ( W <= 0 ) { CUR.error = TT_Err_Divide_By_Zero; return FAILURE; } Vx = MulDiv_Round( Vx, 0x4000L, W ); Vy = MulDiv_Round( Vy, 0x4000L, W ); W = Vx * Vx + Vy * Vy; /* Now, we want that Sqrt( W ) = 0x4000 */ /* Or 0x10000000 <= W < 0x10004000 */ if ( Vx < 0 ) { Vx = -Vx; S1 = TRUE; } else S1 = FALSE; if ( Vy < 0 ) { Vy = -Vy; S2 = TRUE; } else S2 = FALSE; while ( W < 0x10000000L ) { /* We need to increase W, by a minimal amount */ if ( Vx < Vy ) Vx++; else Vy++; W = Vx * Vx + Vy * Vy; } while ( W >= 0x10004000L ) { /* We need to decrease W, by a minimal amount */ if ( Vx < Vy ) Vx--; else Vy--; W = Vx * Vx + Vy * Vy; } /* Note that in various cases, we can only */ /* compute a Sqrt(W) of 0x3FFF, eg. Vx = Vy */ if ( S1 ) Vx = -Vx; if ( S2 ) Vy = -Vy; R->x = (TT_F2Dot14)Vx; /* Type conversion */ R->y = (TT_F2Dot14)Vy; /* Type conversion */ return SUCCESS; }
CWE-125
5,483
14,524
120349632208867475680894473990862118595
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static TT_F26Dot6 Project_x( EXEC_OPS TT_F26Dot6 Vx, TT_F26Dot6 Vy ) { (void)exc; (void)Vy; return Vx; }
CWE-125
5,485
14,525
329242868820792301838661065830847374186
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static TT_F26Dot6 Project_y( EXEC_OPS TT_F26Dot6 Vx, TT_F26Dot6 Vy ) { (void)exc; (void)Vx; return Vy; }
CWE-125
5,486
14,526
225224047003479403767980592311850679079
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static TT_F26Dot6 Read_CVT( EXEC_OPS Int index ) { return CUR.cvt[index]; }
CWE-125
5,487
14,527
325734631702251196660432161926875750573
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static TT_F26Dot6 Read_CVT_Stretched( EXEC_OPS Int index ) { return MulDiv_Round( CUR.cvt[index], CURRENT_Ratio(), 0x10000 ); }
CWE-125
5,488
14,528
225438282244090086197042081489431254211
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static TT_F26Dot6 Round_Down_To_Grid( EXEC_OPS TT_F26Dot6 distance, TT_F26Dot6 compensation ) { TT_F26Dot6 val; (void)exc; if ( distance >= 0 ) { val = (distance + compensation) & (-64); if ( val < 0 ) val = 0; } else { val = -( (compensation - distance) & (-64) ); if ( val > 0 ) val = 0; } return val; }
CWE-125
5,489
14,529
19717007550071806694927638171465223999
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static TT_F26Dot6 Round_None( EXEC_OPS TT_F26Dot6 distance, TT_F26Dot6 compensation ) { TT_F26Dot6 val; (void)exc; if ( distance >= 0 ) { val = distance + compensation; if ( val < 0 ) val = 0; } else { val = distance - compensation; if ( val > 0 ) val = 0; } return val; }
CWE-125
5,490
14,530
254940466559171682462551215726338313946
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static TT_F26Dot6 Round_Super( EXEC_OPS TT_F26Dot6 distance, TT_F26Dot6 compensation ) { TT_F26Dot6 val; if ( distance >= 0 ) { val = (distance - CUR.phase + CUR.threshold + compensation) & (-CUR.period); if ( val < 0 ) val = 0; val += CUR.phase; } else { val = -( (CUR.threshold - CUR.phase - distance + compensation) & (-CUR.period) ); if ( val > 0 ) val = 0; val -= CUR.phase; } return val; }
CWE-125
5,491
14,531
81832868374736900682836790136503948867
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static TT_F26Dot6 Round_Super_45( EXEC_OPS TT_F26Dot6 distance, TT_F26Dot6 compensation ) { TT_F26Dot6 val; if ( distance >= 0 ) { val = ( (distance - CUR.phase + CUR.threshold + compensation) / CUR.period ) * CUR.period; if ( val < 0 ) val = 0; val += CUR.phase; } else { val = -( ( (CUR.threshold - CUR.phase - distance + compensation) / CUR.period ) * CUR.period ); if ( val > 0 ) val = 0; val -= CUR.phase; } return val; }
CWE-125
5,492
14,532
27133567727116653555180301549154869962
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static TT_F26Dot6 Round_To_Double_Grid( EXEC_OPS TT_F26Dot6 distance, TT_F26Dot6 compensation ) { TT_F26Dot6 val; (void)exc; if ( distance >= 0 ) { val = (distance + compensation + 16) & (-32); if ( val < 0 ) val = 0; } else { val = -( (compensation - distance + 16) & (-32) ); if ( val > 0 ) val = 0; } return val; }
CWE-125
5,493
14,533
319390426023089993475995131320305978162
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static TT_F26Dot6 Round_To_Grid( EXEC_OPS TT_F26Dot6 distance, TT_F26Dot6 compensation ) { TT_F26Dot6 val; (void)exc; if ( distance >= 0 ) { val = (distance + compensation + 32) & (-64); if ( val < 0 ) val = 0; } else { val = -( (compensation - distance + 32) & (-64) ); if ( val > 0 ) val = 0; } return val; }
CWE-125
5,494
14,534
80596901377201231695226041458082392159
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static TT_F26Dot6 Round_To_Half_Grid( EXEC_OPS TT_F26Dot6 distance, TT_F26Dot6 compensation ) { TT_F26Dot6 val; (void)exc; if ( distance >= 0 ) { val = ((distance + compensation) & (-64)) + 32; if ( val < 0 ) val = 0; } else { val = -( ((compensation - distance) & (-64)) + 32 ); if ( val > 0 ) val = 0; } return val; }
CWE-125
5,495
14,535
11035404540847199669492430220350906478
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static TT_F26Dot6 Round_Up_To_Grid( EXEC_OPS TT_F26Dot6 distance, TT_F26Dot6 compensation ) { TT_F26Dot6 val; (void)exc; if ( distance >= 0 ) { val = (distance + compensation + 63) & (-64); if ( val < 0 ) val = 0; } else { val = -( (compensation - distance + 63) & (-64) ); if ( val > 0 ) val = 0; } return val; }
CWE-125
5,496
14,536
196927044204505112928993954924487757792
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void SetSuperRound( EXEC_OPS TT_F26Dot6 GridPeriod, Long selector ) { switch ( selector & 0xC0 ) { case 0: CUR.period = GridPeriod / 2; break; case 0x40: CUR.period = GridPeriod; break; case 0x80: CUR.period = GridPeriod * 2; break; /* This opcode is reserved, but... */ case 0xC0: CUR.period = GridPeriod; break; } switch ( selector & 0x30 ) { case 0: CUR.phase = 0; break; case 0x10: CUR.phase = CUR.period / 4; break; case 0x20: CUR.phase = CUR.period / 2; break; case 0x30: CUR.phase = GridPeriod * 3 / 4; break; } if ( (selector & 0x0F) == 0 ) CUR.threshold = CUR.period - 1; else CUR.threshold = ( (Int)(selector & 0x0F) - 4L ) * CUR.period / 8; CUR.period /= 256; CUR.phase /= 256; CUR.threshold /= 256; }
CWE-125
5,497
14,537
196986140193893829656737665601524350925
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Shift( Int p1, Int p2, Int p, struct LOC_Ins_IUP* LINK ) { Int i; TT_F26Dot6 x; x = LINK->curs[p] - LINK->orgs[p]; for ( i = p1; i < p; i++ ) LINK->curs[i] += x; for ( i = p + 1; i <= p2; i++ ) LINK->curs[i] += x; }
CWE-125
5,498
14,538
328539679648339284525105311411539382906
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static Bool SkipCode( EXEC_OP ) { CUR.IP += CUR.length; if ( CUR.IP < CUR.codeSize ) if ( CALC_Length() == SUCCESS ) return SUCCESS; CUR.error = TT_Err_Code_Overflow; return FAILURE; }
CWE-125
5,499
14,539
96811257923031220247113767713726317080
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void Write_CVT( EXEC_OPS Int index, TT_F26Dot6 value ) { int ov=CUR.cvt[index]; (void)ov; /* Quiet compiler warning in release build. */ CUR.cvt[index] = value; DBG_PRINT3(" cvt[%d]%d:=%d", index, ov, CUR.cvt[index]); }
CWE-125
5,500
14,540
178573169820050218871936103781522667869
null
null
null
ghostscript
c501a58f8d5650c8ba21d447c0d6f07eafcb0f15
0
static void skip_FDEF( EXEC_OP ) { /* We don't allow nested IDEFS & FDEFs. */ while ( SKIP_Code() == SUCCESS ) { switch ( CUR.opcode ) { case 0x89: /* IDEF */ case 0x2c: /* FDEF */ CUR.error = TT_Err_Nested_DEFS; return; case 0x2d: /* ENDF */ return; } } }
CWE-125
5,501
14,541
297259921879297707983266613294250610148
null
null
null
ghostscript
937ccd17ac65935633b2ebc06cb7089b91e17e6b
0
static int DebugPrint(ttfFont *ttf, const char *fmt, ...) { char buf[500]; va_list args; int count; if (gs_debug_c('Y')) { va_start(args, fmt); count = vsnprintf(buf, sizeof(buf), fmt, args); /* NB: moved debug output from stdout to stderr */ errwrite(ttf->DebugMem, buf, count); va_end(args); } return 0; }
CWE-125
5,502
14,542
102767267691918943586889959621467929997
null
null
null
ghostscript
937ccd17ac65935633b2ebc06cb7089b91e17e6b
0
static void DebugRepaint(ttfFont *ttf) { }
CWE-125
5,503
14,543
286089219798736257805883663553156049281
null
null
null
ghostscript
937ccd17ac65935633b2ebc06cb7089b91e17e6b
0
ENUM_PTRS_WITH(gx_ttfReader_enum_ptrs, gx_ttfReader *mptr) { /* The fields 'pfont' and 'glyph_data' may contain pointers from global to local memory ( see a comment in gxttfb.h). They must be NULL when a garbager is invoked. Due to that we don't enumerate and don't relocate them. */ DISCARD(mptr); return 0; }
CWE-125
5,504
14,544
73639604764499646361971059129342564937
null
null
null
ghostscript
937ccd17ac65935633b2ebc06cb7089b91e17e6b
0
static void WarnBadInstruction(gs_font_type42 *pfont, int glyph_index) { char buf[gs_font_name_max + 1]; int l; gs_font_type42 *base_font = pfont; while ((gs_font_type42 *)base_font->base != base_font) base_font = (gs_font_type42 *)base_font->base; if (!base_font->data.warning_bad_instruction) { l = min(sizeof(buf) - 1, base_font->font_name.size); memcpy(buf, base_font->font_name.chars, l); buf[l] = 0; if (glyph_index >= 0) emprintf2(pfont->memory, "Failed to interpret TT instructions for glyph index %d of font %s. " "Continue ignoring instructions of the font.\n", glyph_index, buf); else emprintf1(pfont->memory, "Failed to interpret TT instructions in font %s. " "Continue ignoring instructions of the font.\n", buf); base_font->data.warning_bad_instruction = true; } }
CWE-125
5,505
14,545
142127128256168230812804297385474077497
null
null
null
ghostscript
937ccd17ac65935633b2ebc06cb7089b91e17e6b
0
static void WarnPatented(gs_font_type42 *pfont, ttfFont *ttf, const char *txt) { if (!ttf->design_grid) { char buf[gs_font_name_max + 1]; int l; gs_font_type42 *base_font = pfont; while ((gs_font_type42 *)base_font->base != base_font) base_font = (gs_font_type42 *)base_font->base; if (!base_font->data.warning_patented) { l = min(sizeof(buf) - 1, base_font->font_name.size); memcpy(buf, base_font->font_name.chars, l); buf[l] = 0; emprintf2(pfont->memory, "%s %s requires a patented True Type interpreter.\n", txt, buf); base_font->data.warning_patented = true; } } }
CWE-125
5,506
14,546
142152965095534256792436243099557581975
null
null
null
ghostscript
937ccd17ac65935633b2ebc06cb7089b91e17e6b
0
static void decompose_matrix(const gs_font_type42 *pfont, const gs_matrix * char_tm, const gs_log2_scale_point *log2_scale, bool design_grid, gs_point *char_size, gs_point *subpix_origin, gs_matrix *post_transform, bool *dg) { /* * char_tm maps to subpixels. */ /* * We use a Free Type 1 True Type interpreter, which cannot perform * a grid-fitting with skewing/rotation. It appears acceptable * because we want to minimize invocations of patented instructions. * We believe that skewing/rotation requires the patented intrivial cases * of projection/freedom vectors. */ int scale_x = 1 << log2_scale->x; int scale_y = 1 << log2_scale->y; bool atp = gs_currentaligntopixels(pfont->dir); bool design_grid1; char_size->x = hypot(char_tm->xx, char_tm->xy); char_size->y = hypot(char_tm->yx, char_tm->yy); if (char_size->x <= 2 && char_size->y <= 2) { /* Disable the grid fitting for very small fonts. */ design_grid1 = true; } else design_grid1 = design_grid || !(gs_currentgridfittt(pfont->dir) & 1); *dg = design_grid1; subpix_origin->x = (atp ? 0 : reminder(char_tm->tx, scale_x) / scale_x); subpix_origin->y = (atp ? 0 : reminder(char_tm->ty, scale_y) / scale_y); post_transform->xx = char_tm->xx / (design_grid1 ? 1 : char_size->x); post_transform->xy = char_tm->xy / (design_grid1 ? 1 : char_size->x); post_transform->yx = char_tm->yx / (design_grid1 ? 1 : char_size->y); post_transform->yy = char_tm->yy / (design_grid1 ? 1 : char_size->y); post_transform->tx = char_tm->tx - subpix_origin->x; post_transform->ty = char_tm->ty - subpix_origin->y; }
CWE-125
5,507
14,547
287570139462681969282316582142287842430
null
null
null
ghostscript
937ccd17ac65935633b2ebc06cb7089b91e17e6b
0
static int grid_fit(gx_device_spot_analyzer *padev, gx_path *path, gs_font_type42 *pfont, const gs_log2_scale_point *pscale, gx_ttfExport *e, ttfOutliner *o) { /* Not completed yet. */ gs_gstate gs_stub; gx_fill_params params; gx_device_color devc_stub; int code; t1_hinter_aux h; gs_matrix m, fm, fmb; gs_matrix_fixed ctm_temp; bool atp = gs_currentaligntopixels(pfont->dir); int FontType = 1; /* Will apply Type 1 hinter. */ fixed sbx = 0, sby = 0; /* stub */ double scale = 1.0 / o->pFont->nUnitsPerEm; gs_fixed_rect bbox; m.xx = o->post_transform.a; m.xy = o->post_transform.b; m.yx = o->post_transform.c; m.yy = o->post_transform.d; m.tx = o->post_transform.tx; m.ty = o->post_transform.ty; code = gs_matrix_fixed_from_matrix(&ctm_temp, &m); if (code < 0) return code; code = gs_matrix_scale(&pfont->FontMatrix, scale, scale, &fm); if (code < 0) return code; code = gs_matrix_scale(&pfont->base->FontMatrix, scale, scale, &fmb); if (code < 0) return code; t1_hinter__init(&h.super, path); /* Will export to */ code = t1_hinter__set_mapping(&h.super, &ctm_temp, &fm, &fmb, pscale->x, pscale->x, 0, 0, ctm_temp.tx_fixed, ctm_temp.ty_fixed, atp); if (code < 0) return code; if (!h.super.disable_hinting) { o->post_transform.a = o->post_transform.d = 1; o->post_transform.b = o->post_transform.c = 0; o->post_transform.tx = o->post_transform.ty = 0; ttfOutliner__DrawGlyphOutline(o); if (e->error) return e->error; code = t1_hinter__set_font42_data(&h.super, FontType, &pfont->data, false); if (code < 0) return code; code = t1_hinter__sbw(&h.super, sbx, sby, e->w.x, e->w.y); if (code < 0) return code; code = gx_path_bbox(path, &bbox); if (code < 0) return code; memset(&gs_stub, 0, sizeof(gs_stub)); gs_stub.memory = padev->memory; set_nonclient_dev_color(&devc_stub, 1); params.rule = gx_rule_winding_number; params.adjust.x = params.adjust.y = 0; params.flatness = fixed2float(max(bbox.q.x - bbox.p.x, bbox.q.y - bbox.p.y)) / 100.0; for (h.transpose = 0; h.transpose < 2; h.transpose++) { h.midx = (padev->xmin + padev->xmax) / 2; if (h.transpose) transpose_path(path); gx_san_begin(padev); code = dev_proc(padev, fill_path)((gx_device *)padev, &gs_stub, path, &params, &devc_stub, NULL); gx_san_end(padev); if (code >= 0) code = gx_san_generate_stems(padev, OVERALL_HINT && h.transpose, &h, stem_hint_handler); if (h.transpose) transpose_path(path); if (code < 0) return code; } /* fixme : Storing hints permanently would be useful. Note that if (gftt & 1), the outline and hints are already scaled. */ code = path_to_hinter(&h.super, path); if (code < 0) return code; code = gx_path_new(path); if (code < 0) return code; code = t1_hinter__endglyph(&h.super); } else { ttfOutliner__DrawGlyphOutline(o); if (e->error) return e->error; } return code; }
CWE-125
5,508
14,548
157724392773551405003776835126895368578
null
null
null
ghostscript
937ccd17ac65935633b2ebc06cb7089b91e17e6b
0
static void gx_ttfExport__Close(ttfExport *self) { gx_ttfExport *e = (gx_ttfExport *)self; if (!e->error) e->error = gx_path_close_subpath_notes(e->path, sn_none); }
CWE-125
5,509
14,549
259563739708746851272572827250826602433
null
null
null
ghostscript
937ccd17ac65935633b2ebc06cb7089b91e17e6b
0
static void gx_ttfExport__CurveTo(ttfExport *self, FloatPoint *p0, FloatPoint *p1, FloatPoint *p2) { gx_ttfExport *e = (gx_ttfExport *)self; if (!e->error) { if (e->monotonize) { curve_segment s; s.notes = sn_none; s.p1.x = float2fixed(p0->x), s.p1.y = float2fixed(p0->y), s.p2.x = float2fixed(p1->x), s.p2.y = float2fixed(p1->y), s.pt.x = float2fixed(p2->x), s.pt.y = float2fixed(p2->y); e->error = gx_curve_monotonize(e->path, &s); } else e->error = gx_path_add_curve_notes(e->path, float2fixed(p0->x), float2fixed(p0->y), float2fixed(p1->x), float2fixed(p1->y), float2fixed(p2->x), float2fixed(p2->y), sn_none); } }
CWE-125
5,510
14,550
256577359223543577142926486814474044509
null
null
null
ghostscript
937ccd17ac65935633b2ebc06cb7089b91e17e6b
0
static void gx_ttfExport__DebugPaint(ttfExport *self) { }
CWE-125
5,511
14,551
204675894742020459117780914852492616002
null
null
null
ghostscript
937ccd17ac65935633b2ebc06cb7089b91e17e6b
0
static void gx_ttfExport__LineTo(ttfExport *self, FloatPoint *p) { gx_ttfExport *e = (gx_ttfExport *)self; if (!e->error) e->error = gx_path_add_line_notes(e->path, float2fixed(p->x), float2fixed(p->y), sn_none); }
CWE-125
5,512
14,552
30923700810581277669818600151913390619
null
null
null
ghostscript
937ccd17ac65935633b2ebc06cb7089b91e17e6b
0
static void gx_ttfExport__MoveTo(ttfExport *self, FloatPoint *p) { gx_ttfExport *e = (gx_ttfExport *)self; if (!e->error) e->error = gx_path_add_point(e->path, float2fixed(p->x), float2fixed(p->y)); }
CWE-125
5,513
14,553
134198900391861112042587834933733071974
null
null
null
ghostscript
937ccd17ac65935633b2ebc06cb7089b91e17e6b
0
static void gx_ttfExport__Point(ttfExport *self, FloatPoint *p, bool bOnCurve, bool bNewPath) { /* Never called. */ }
CWE-125
5,514
14,554
163275954899630011793170839729243963654
null
null
null
ghostscript
937ccd17ac65935633b2ebc06cb7089b91e17e6b
0
static void *gx_ttfMemory__alloc_bytes(ttfMemory *self, int size, const char *cname) { gs_memory_t *mem = ((gx_ttfMemory *)self)->memory; return gs_alloc_bytes(mem, size, cname); }
CWE-125
5,516
14,555
269948941971246673902681580616576509040
null
null
null
ghostscript
937ccd17ac65935633b2ebc06cb7089b91e17e6b
0
static void *gx_ttfMemory__alloc_struct(ttfMemory *self, const ttfMemoryDescriptor *d, const char *cname) { gs_memory_t *mem = ((gx_ttfMemory *)self)->memory; return mem->procs.alloc_struct(mem, (const gs_memory_struct_type_t *)d, cname); }
CWE-125
5,517
14,556
312363293063926231983603197986640447382
null
null
null
ghostscript
937ccd17ac65935633b2ebc06cb7089b91e17e6b
0
static bool gx_ttfReader__Eof(ttfReader *self) { gx_ttfReader *r = (gx_ttfReader *)self; if (r->extra_glyph_index != -1) return r->pos >= r->glyph_data.bits.size; /* We can't know whether pfont->data.string_proc has more bytes, so we never report Eof for it. */ return false; }
CWE-125
5,519
14,557
9559982170305745638452182017251363585
null
null
null
ghostscript
937ccd17ac65935633b2ebc06cb7089b91e17e6b
0
static bool gx_ttfReader__Error(ttfReader *self) { gx_ttfReader *r = (gx_ttfReader *)self; return r->error; }
CWE-125
5,520
14,558
259390166163370351759421217472531579938
null
null
null
ghostscript
937ccd17ac65935633b2ebc06cb7089b91e17e6b
0
static int gx_ttfReader__LoadGlyph(ttfReader *self, int glyph_index, const byte **p, int *size) { gx_ttfReader *r = (gx_ttfReader *)self; gs_font_type42 *pfont = r->pfont; int code; if (r->extra_glyph_index != -1) return 0; /* We only maintain a single glyph buffer. It's enough because ttfOutliner__BuildGlyphOutline is optimized for that, and pfont->data.get_outline implements a charstring cache. */ r->glyph_data.memory = pfont->memory; code = pfont->data.get_outline(pfont, (uint)glyph_index, &r->glyph_data); r->extra_glyph_index = glyph_index; r->pos = 0; if (code < 0) r->error = code; else if (code > 0) { /* Should not happen. */ r->error = gs_note_error(gs_error_unregistered); } else { *p = r->glyph_data.bits.data; *size = r->glyph_data.bits.size; } return 2; /* found */ }
CWE-125
5,521
14,559
193384620005810766912336497703494311154
null
null
null
ghostscript
937ccd17ac65935633b2ebc06cb7089b91e17e6b
0
static void gx_ttfReader__ReleaseGlyph(ttfReader *self, int glyph_index) { gx_ttfReader *r = (gx_ttfReader *)self; if (r->extra_glyph_index != glyph_index) return; r->extra_glyph_index = -1; gs_glyph_data_free(&r->glyph_data, "gx_ttfReader__ReleaseExtraGlyph"); }
CWE-125
5,522
14,560
142530177083497441036988107695245073169
null
null
null
ghostscript
937ccd17ac65935633b2ebc06cb7089b91e17e6b
0
static void gx_ttfReader__Reset(gx_ttfReader *self) { if (self->extra_glyph_index != -1) { self->extra_glyph_index = -1; gs_glyph_data_free(&self->glyph_data, "gx_ttfReader__Reset"); } self->error = false; self->pos = 0; }
CWE-125
5,523
14,561
168409078251237233192409304800531253175
null
null
null
ghostscript
937ccd17ac65935633b2ebc06cb7089b91e17e6b
0
static void gx_ttfReader__Seek(ttfReader *self, int nPos) { gx_ttfReader *r = (gx_ttfReader *)self; r->pos = nPos; }
CWE-125
5,524
14,562
27149157762356125941716715159959524432
null
null
null
ghostscript
937ccd17ac65935633b2ebc06cb7089b91e17e6b
0
static int gx_ttfReader__Tell(ttfReader *self) { gx_ttfReader *r = (gx_ttfReader *)self; return r->pos; }
CWE-125
5,525
14,563
240267415861986289113241570067517238642
null
null
null
ghostscript
937ccd17ac65935633b2ebc06cb7089b91e17e6b
0
gx_ttfReader *gx_ttfReader__create(gs_memory_t *mem) { gx_ttfReader *r = gs_alloc_struct(mem, gx_ttfReader, &st_gx_ttfReader, "gx_ttfReader__create"); if (r != NULL) { r->super.Eof = gx_ttfReader__Eof; r->super.Read = gx_ttfReader__Read; r->super.Seek = gx_ttfReader__Seek; r->super.Tell = gx_ttfReader__Tell; r->super.Error = gx_ttfReader__Error; r->super.LoadGlyph = gx_ttfReader__LoadGlyph; r->super.ReleaseGlyph = gx_ttfReader__ReleaseGlyph; r->pos = 0; r->error = false; r->extra_glyph_index = -1; memset(&r->glyph_data, 0, sizeof(r->glyph_data)); r->pfont = NULL; r->memory = mem; gx_ttfReader__Reset(r); } return r; }
CWE-125
5,526
14,564
26142844088108182550105918392926763453
null
null
null
ghostscript
937ccd17ac65935633b2ebc06cb7089b91e17e6b
0
gx_ttfReader__default_get_metrics(const ttfReader *ttf, uint glyph_index, bool bVertical, short *sideBearing, unsigned short *nAdvance) { gx_ttfReader *self = (gx_ttfReader *)ttf; float sbw[4]; int sbw_offset = bVertical; int code; int factor = self->pfont->data.unitsPerEm; code = self->pfont->data.get_metrics(self->pfont, glyph_index, bVertical, sbw); if (code < 0) return code; /* Due to an obsolete convention, simple_glyph_metrics scales the metrics into 1x1 rectangle as Postscript like. In same time, the True Type interpreter needs the original design units. Undo the scaling here with accurate rounding. */ *sideBearing = (short)floor(sbw[0 + sbw_offset] * factor + 0.5); *nAdvance = (short)floor(sbw[2 + sbw_offset] * factor + 0.5); return 0; }
CWE-125
5,527
14,565
331009124007626768918877638525967488084
null
null
null
ghostscript
937ccd17ac65935633b2ebc06cb7089b91e17e6b
0
void gx_ttfReader__destroy(gx_ttfReader *self) { gs_free_object(self->memory, self, "gx_ttfReader__destroy"); }
CWE-125
5,528
14,566
79593293578172864167583347736001208548
null
null
null
ghostscript
937ccd17ac65935633b2ebc06cb7089b91e17e6b
0
void gx_ttfReader__set_font(gx_ttfReader *self, gs_font_type42 *pfont) { self->pfont = pfont; self->super.get_metrics = gx_ttfReader__default_get_metrics; }
CWE-125
5,529
14,567
158584095502809716630205120397324541050
null
null
null
ghostscript
937ccd17ac65935633b2ebc06cb7089b91e17e6b
0
int gx_ttf_outline(ttfFont *ttf, gx_ttfReader *r, gs_font_type42 *pfont, int glyph_index, const gs_matrix *m, const gs_log2_scale_point *pscale, gx_path *path, bool design_grid) { gx_ttfExport e; ttfOutliner o; gs_point char_size, subpix_origin; gs_matrix post_transform; /* Ghostscript proceses a TTC index in gs/lib/gs_ttf.ps, */ /* so that TTC never comes here. */ FloatMatrix m1; bool dg; uint gftt = gs_currentgridfittt(pfont->dir); bool ttin = (gftt & 1); /* gs_currentgridfittt values (binary) : 00 - no grid fitting; 01 - Grid fit with TT interpreter; On failure warn and render unhinted. 10 - Interpret in the design grid and then autohint. 11 - Grid fit with TT interpreter; On failure render autohinted. */ bool auth = (gftt & 2); decompose_matrix(pfont, m, pscale, design_grid, &char_size, &subpix_origin, &post_transform, &dg); m1.a = post_transform.xx; m1.b = post_transform.xy; m1.c = post_transform.yx; m1.d = post_transform.yy; m1.tx = post_transform.tx; m1.ty = post_transform.ty; e.super.bPoints = false; e.super.bOutline = true; e.super.MoveTo = gx_ttfExport__MoveTo; e.super.LineTo = gx_ttfExport__LineTo; e.super.CurveTo = gx_ttfExport__CurveTo; e.super.Close = gx_ttfExport__Close; e.super.Point = gx_ttfExport__Point; e.super.SetWidth = gx_ttfExport__SetWidth; e.super.DebugPaint = gx_ttfExport__DebugPaint; e.error = 0; e.path = path; e.w.x = 0; e.w.y = 0; e.monotonize = auth; gx_ttfReader__Reset(r); ttfOutliner__init(&o, ttf, &r->super, &e.super, true, false, pfont->WMode != 0); switch(ttfOutliner__Outline(&o, glyph_index, subpix_origin.x, subpix_origin.y, &m1)) { case fBadInstruction: WarnBadInstruction(pfont, glyph_index); goto recover; case fPatented: /* The returned outline did not apply a bytecode (it is not grid-fitted). */ if (!auth) WarnPatented(pfont, ttf, "Some glyphs of the font"); recover : if (!design_grid && auth) return grid_fit(pfont->dir->san, path, pfont, pscale, &e, &o); /* Falls through. */ case fNoError: if (!design_grid && !ttin && auth) return grid_fit(pfont->dir->san, path, pfont, pscale, &e, &o); ttfOutliner__DrawGlyphOutline(&o); if (e.error) return e.error; return 0; case fMemoryError: return_error(gs_error_VMerror); case fUnimplemented: return_error(gs_error_unregistered); default: { int code = r->super.Error(&r->super); if (code < 0) return code; return_error(gs_error_invalidfont); } } }
CWE-125
5,530
14,568
237044278301657838953921943929175445535
null
null
null
ghostscript
937ccd17ac65935633b2ebc06cb7089b91e17e6b
0
path_to_hinter(t1_hinter *h, gx_path *path) { int code; gs_path_enum penum; gs_fixed_point pts[3]; gs_fixed_point p = {0, 0}; /* initialize to avoid a warning */ bool first = true; int op; code = gx_path_enum_init(&penum, path); if (code < 0) return code; while ((op = gx_path_enum_next(&penum, pts)) != 0) { switch (op) { case gs_pe_moveto: if (first) { first = false; p = pts[0]; code = t1_hinter__rmoveto(h, p.x, p.y); } else code = t1_hinter__rmoveto(h, pts[0].x - p.x, pts[0].y - p.y); break; case gs_pe_lineto: case gs_pe_gapto: code = t1_hinter__rlineto(h, pts[0].x - p.x, pts[0].y - p.y); break; case gs_pe_curveto: code = t1_hinter__rcurveto(h, pts[0].x - p.x, pts[0].y - p.y, pts[1].x - pts[0].x, pts[1].y - pts[0].y, pts[2].x - pts[1].x, pts[2].y - pts[1].y); pts[0] = pts[2]; break; case gs_pe_closepath: code = t1_hinter__closepath(h); break; default: return_error(gs_error_unregistered); } if (code < 0) return code; p = pts[0]; } return 0; }
CWE-125
5,531
14,569
237025439611789024901858484174467484621
null
null
null
ghostscript
937ccd17ac65935633b2ebc06cb7089b91e17e6b
0
static inline float reminder(float v, int x) { return ((v / x) - floor(v / x)) * x; }
CWE-125
5,532
14,570
276790090165000274835701126749668217638
null
null
null
ghostscript
937ccd17ac65935633b2ebc06cb7089b91e17e6b
0
stem_hint_handler(void *client_data, gx_san_sect *ss) { t1_hinter_aux *h = (t1_hinter_aux *)client_data; if (ss->side_mask == 3) { /* Orient horizontal hints to help with top/bottom alignment zones. Otherwize glyphs may get a random height due to serif adjustsment. */ if (ss->xl > h->midx && h->transpose) return (h->transpose ? t1_hinter__hstem : t1_hinter__vstem) (&h->super, ss->xr, ss->xl - ss->xr); else return (h->transpose ? t1_hinter__hstem : t1_hinter__vstem) (&h->super, ss->xl, ss->xr - ss->xl); } else return t1_hinter__overall_hstem(&h->super, ss->xl, ss->xr - ss->xl, ss->side_mask); }
CWE-125
5,533
14,571
257960629922763288765831016250961750070
null
null
null
ghostscript
937ccd17ac65935633b2ebc06cb7089b91e17e6b
0
transpose_path(gx_path *path) { segment *s = (segment *)path->first_subpath; exch(path->bbox.p.x, path->bbox.p.y); exch(path->bbox.q.x, path->bbox.q.y); for (; s; s = s->next) { if (s->type == s_curve) { curve_segment *c = (curve_segment *)s; exch(c->p1.x, c->p1.y); exch(c->p2.x, c->p2.y); } exch(s->pt.x, s->pt.y); } }
CWE-125
5,534
14,572
99219387815683366301275957410167908705
null
null
null
ghostscript
937ccd17ac65935633b2ebc06cb7089b91e17e6b
0
int ttfFont__Open_aux(ttfFont *self, ttfInterpreter *tti, gx_ttfReader *r, gs_font_type42 *pfont, const gs_matrix * char_tm, const gs_log2_scale_point *log2_scale, bool design_grid) { gs_point char_size, subpix_origin; gs_matrix post_transform; /* * Ghostscript proceses a TTC index in gs/lib/gs_ttf.ps, * and *pfont already adjusted to it. * Therefore TTC headers never comes here. */ unsigned int nTTC = 0; bool dg; decompose_matrix(pfont, char_tm, log2_scale, design_grid, &char_size, &subpix_origin, &post_transform, &dg); switch(ttfFont__Open(tti, self, &r->super, nTTC, char_size.x, char_size.y, dg)) { case fNoError: return 0; case fMemoryError: return_error(gs_error_VMerror); case fUnimplemented: return_error(gs_error_unregistered); case fBadInstruction: WarnBadInstruction(pfont, -1); goto recover; case fPatented: WarnPatented(pfont, self, "The font"); recover: self->patented = true; return 0; default: { int code = r->super.Error(&r->super); if (code < 0) return code; return_error(gs_error_invalidfont); } } }
CWE-125
5,535
14,573
232071823989148611096335336911203962392
null
null
null