idx
int64 | func_before
string | Vulnerability Classification
string | vul
int64 | func_after
string | patch
string | CWE ID
string | lines_before
string | lines_after
string |
|---|---|---|---|---|---|---|---|---|
4,300
|
static void Ins_MPS( INS_ARG )
{
args[0] = CUR.metrics.pointSize;
}
|
DoS
| 0
|
static void Ins_MPS( INS_ARG )
{
args[0] = CUR.metrics.pointSize;
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,301
|
static void Ins_MSIRP( INS_ARG )
{
Int point;
TT_F26Dot6 distance;
point = (Int)args[0];
if ( BOUNDS( args[0], CUR.zp1.n_points ) )
{
CUR.error = TT_Err_Invalid_Reference;
return;
}
/* XXX: Undocumented behaviour */
if ( CUR.GS.gep0 == 0 ) /* if in twilight zone */
{
CUR.zp1.org_x[point] = CUR.zp0.org_x[CUR.GS.rp0];
CUR.zp1.org_y[point] = CUR.zp0.org_y[CUR.GS.rp0];
CUR.zp1.cur_x[point] = CUR.zp1.org_x[point];
CUR.zp1.cur_y[point] = CUR.zp1.org_y[point];
}
distance = CUR_Func_project( CUR.zp1.cur_x[point] -
CUR.zp0.cur_x[CUR.GS.rp0],
CUR.zp1.cur_y[point] -
CUR.zp0.cur_y[CUR.GS.rp0] );
CUR_Func_move( &CUR.zp1, point, args[1] - distance );
CUR.GS.rp1 = CUR.GS.rp0;
CUR.GS.rp2 = point;
if ( (CUR.opcode & 1) != 0 )
CUR.GS.rp0 = point;
}
|
DoS
| 0
|
static void Ins_MSIRP( INS_ARG )
{
Int point;
TT_F26Dot6 distance;
point = (Int)args[0];
if ( BOUNDS( args[0], CUR.zp1.n_points ) )
{
CUR.error = TT_Err_Invalid_Reference;
return;
}
/* XXX: Undocumented behaviour */
if ( CUR.GS.gep0 == 0 ) /* if in twilight zone */
{
CUR.zp1.org_x[point] = CUR.zp0.org_x[CUR.GS.rp0];
CUR.zp1.org_y[point] = CUR.zp0.org_y[CUR.GS.rp0];
CUR.zp1.cur_x[point] = CUR.zp1.org_x[point];
CUR.zp1.cur_y[point] = CUR.zp1.org_y[point];
}
distance = CUR_Func_project( CUR.zp1.cur_x[point] -
CUR.zp0.cur_x[CUR.GS.rp0],
CUR.zp1.cur_y[point] -
CUR.zp0.cur_y[CUR.GS.rp0] );
CUR_Func_move( &CUR.zp1, point, args[1] - distance );
CUR.GS.rp1 = CUR.GS.rp0;
CUR.GS.rp2 = point;
if ( (CUR.opcode & 1) != 0 )
CUR.GS.rp0 = point;
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,302
|
static void Ins_MUL( INS_ARG )
{ (void)exc;
args[0] = MulDiv_Round( args[0], args[1], 64L );
}
|
DoS
| 0
|
static void Ins_MUL( INS_ARG )
{ (void)exc;
args[0] = MulDiv_Round( args[0], args[1], 64L );
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,303
|
static void Ins_NEG( INS_ARG )
{ (void)exc;
args[0] = -args[0];
}
|
DoS
| 0
|
static void Ins_NEG( INS_ARG )
{ (void)exc;
args[0] = -args[0];
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,304
|
static void Ins_NEQ( INS_ARG )
{ (void)exc;
if ( args[0] != args[1] )
args[0] = 1;
else
args[0] = 0;
}
|
DoS
| 0
|
static void Ins_NEQ( INS_ARG )
{ (void)exc;
if ( args[0] != args[1] )
args[0] = 1;
else
args[0] = 0;
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,305
|
static void Ins_NOT( INS_ARG )
{ (void)exc;
if ( args[0] != 0 )
args[0] = 0;
else
args[0] = 1;
}
|
DoS
| 0
|
static void Ins_NOT( INS_ARG )
{ (void)exc;
if ( args[0] != 0 )
args[0] = 0;
else
args[0] = 1;
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,306
|
static void Ins_NPUSHB( INS_ARG )
{
Int L, K;
L = (Int)CUR.code[CUR.IP + 1];
if ( BOUNDS( L, CUR.stackSize+1-CUR.top ) )
{
CUR.error = TT_Err_Stack_Overflow;
return;
}
for ( K = 1; K <= L; K++ )
{ args[K - 1] = CUR.code[CUR.IP + K + 1];
DBG_PRINT1(" %d", args[K - 1]);
}
CUR.new_top += L;
}
|
DoS
| 0
|
static void Ins_NPUSHB( INS_ARG )
{
Int L, K;
L = (Int)CUR.code[CUR.IP + 1];
if ( BOUNDS( L, CUR.stackSize+1-CUR.top ) )
{
CUR.error = TT_Err_Stack_Overflow;
return;
}
for ( K = 1; K <= L; K++ )
{ args[K - 1] = CUR.code[CUR.IP + K + 1];
DBG_PRINT1(" %d", args[K - 1]);
}
CUR.new_top += L;
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,307
|
static void Ins_NPUSHW( INS_ARG )
{
Int L, K;
L = (Int)CUR.code[CUR.IP + 1];
if ( BOUNDS( L, CUR.stackSize+1-CUR.top ) )
{
CUR.error = TT_Err_Stack_Overflow;
return;
}
CUR.IP += 2;
for ( K = 0; K < L; K++ )
{ args[K] = GET_ShortIns();
DBG_PRINT1(" %d", args[K]);
}
CUR.step_ins = FALSE;
CUR.new_top += L;
}
|
DoS
| 0
|
static void Ins_NPUSHW( INS_ARG )
{
Int L, K;
L = (Int)CUR.code[CUR.IP + 1];
if ( BOUNDS( L, CUR.stackSize+1-CUR.top ) )
{
CUR.error = TT_Err_Stack_Overflow;
return;
}
CUR.IP += 2;
for ( K = 0; K < L; K++ )
{ args[K] = GET_ShortIns();
DBG_PRINT1(" %d", args[K]);
}
CUR.step_ins = FALSE;
CUR.new_top += L;
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,308
|
static void Ins_NROUND( INS_ARG )
{
args[0] = Round_None( EXEC_ARGS
args[0],
CUR.metrics.compensations[CUR.opcode - 0x6C] );
}
|
DoS
| 0
|
static void Ins_NROUND( INS_ARG )
{
args[0] = Round_None( EXEC_ARGS
args[0],
CUR.metrics.compensations[CUR.opcode - 0x6C] );
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,309
|
static void Ins_ODD( INS_ARG )
{
if ( (CUR_Func_round( args[0], 0L ) & 127) == 64 )
args[0] = 1;
else
args[0] = 0;
}
|
DoS
| 0
|
static void Ins_ODD( INS_ARG )
{
if ( (CUR_Func_round( args[0], 0L ) & 127) == 64 )
args[0] = 1;
else
args[0] = 0;
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,310
|
static void Ins_OR( INS_ARG )
{ (void)exc;
if ( args[0] != 0 || args[1] != 0 )
args[0] = 1;
else
args[0] = 0;
}
|
DoS
| 0
|
static void Ins_OR( INS_ARG )
{ (void)exc;
if ( args[0] != 0 || args[1] != 0 )
args[0] = 1;
else
args[0] = 0;
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,311
|
static void Ins_POP( INS_ARG )
{ (void)exc; (void)args;
/* nothing to do */
}
|
DoS
| 0
|
static void Ins_POP( INS_ARG )
{ (void)exc; (void)args;
/* nothing to do */
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,312
|
static void Ins_PUSHB( INS_ARG )
{
Int L, K;
L = ((Int)CUR.opcode - 0xB0 + 1);
if ( BOUNDS( L, CUR.stackSize+1-CUR.top ) )
{
CUR.error = TT_Err_Stack_Overflow;
return;
}
for ( K = 1; K <= L; K++ )
{ args[K - 1] = CUR.code[CUR.IP + K];
DBG_PRINT1(" %d", args[K - 1]);
}
}
|
DoS
| 0
|
static void Ins_PUSHB( INS_ARG )
{
Int L, K;
L = ((Int)CUR.opcode - 0xB0 + 1);
if ( BOUNDS( L, CUR.stackSize+1-CUR.top ) )
{
CUR.error = TT_Err_Stack_Overflow;
return;
}
for ( K = 1; K <= L; K++ )
{ args[K - 1] = CUR.code[CUR.IP + K];
DBG_PRINT1(" %d", args[K - 1]);
}
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,313
|
static void Ins_PUSHW( INS_ARG )
{
Int L, K;
L = CUR.opcode - 0xB8 + 1;
if ( BOUNDS( L, CUR.stackSize+1-CUR.top ) )
{
CUR.error = TT_Err_Stack_Overflow;
return;
}
CUR.IP++;
for ( K = 0; K < L; K++ )
{ args[K] = GET_ShortIns();
DBG_PRINT1(" %d", args[K]);
}
CUR.step_ins = FALSE;
}
|
DoS
| 0
|
static void Ins_PUSHW( INS_ARG )
{
Int L, K;
L = CUR.opcode - 0xB8 + 1;
if ( BOUNDS( L, CUR.stackSize+1-CUR.top ) )
{
CUR.error = TT_Err_Stack_Overflow;
return;
}
CUR.IP++;
for ( K = 0; K < L; K++ )
{ args[K] = GET_ShortIns();
DBG_PRINT1(" %d", args[K]);
}
CUR.step_ins = FALSE;
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,314
|
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]);
}
|
DoS
| 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]);
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,315
|
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;
}
|
DoS
| 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;
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,316
|
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;
}
|
DoS
| 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;
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,317
|
static void Ins_ROUND( INS_ARG )
{
args[0] = CUR_Func_round( args[0],
CUR.metrics.compensations[CUR.opcode - 0x68] );
}
|
DoS
| 0
|
static void Ins_ROUND( INS_ARG )
{
args[0] = CUR_Func_round( args[0],
CUR.metrics.compensations[CUR.opcode - 0x68] );
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,318
|
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]];
}
|
DoS
| 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]];
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,319
|
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;
}
|
DoS
| 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;
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,320
|
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;
}
|
DoS
| 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;
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,321
|
static void Ins_SANGW( INS_ARG )
{ (void)exc; (void)args;
/* instruction not supported anymore */
}
|
DoS
| 0
|
static void Ins_SANGW( INS_ARG )
{ (void)exc; (void)args;
/* instruction not supported anymore */
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,322
|
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];
}
}
|
DoS
| 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];
}
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,323
|
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];
}
}
|
DoS
| 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];
}
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,324
|
static void Ins_SDB( INS_ARG )
{
CUR.GS.delta_base = (Int)args[0];
}
|
DoS
| 0
|
static void Ins_SDB( INS_ARG )
{
CUR.GS.delta_base = (Int)args[0];
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,325
|
static void Ins_SDS( INS_ARG )
{
CUR.GS.delta_shift = (Int)args[0];
}
|
DoS
| 0
|
static void Ins_SDS( INS_ARG )
{
CUR.GS.delta_shift = (Int)args[0];
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,326
|
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();
}
|
DoS
| 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();
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,327
|
static void Ins_SFVTL( INS_ARG )
{
if ( INS_SxVTL( (Int)(args[1]),
(Int)(args[0]),
CUR.opcode,
&CUR.GS.freeVector) == FAILURE )
return;
COMPUTE_Funcs();
}
|
DoS
| 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();
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,328
|
static void Ins_SFVTPV( INS_ARG )
{ (void)args;
CUR.GS.freeVector = CUR.GS.projVector;
COMPUTE_Funcs();
}
|
DoS
| 0
|
static void Ins_SFVTPV( INS_ARG )
{ (void)args;
CUR.GS.freeVector = CUR.GS.projVector;
COMPUTE_Funcs();
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,329
|
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 );
}
}
|
DoS
| 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 );
}
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,330
|
static void Ins_SMD( INS_ARG )
{
CUR.GS.minimum_distance = args[0];
}
|
DoS
| 0
|
static void Ins_SMD( INS_ARG )
{
CUR.GS.minimum_distance = args[0];
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,331
|
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();
}
|
DoS
| 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();
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,332
|
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();
}
|
DoS
| 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();
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,333
|
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();
}
|
DoS
| 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();
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,334
|
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;
}
|
DoS
| 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;
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,335
|
static void Ins_SRP0( INS_ARG )
{
CUR.GS.rp0 = (Int)(args[0]);
}
|
DoS
| 0
|
static void Ins_SRP0( INS_ARG )
{
CUR.GS.rp0 = (Int)(args[0]);
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,336
|
static void Ins_SRP1( INS_ARG )
{
CUR.GS.rp1 = (Int)(args[0]);
}
|
DoS
| 0
|
static void Ins_SRP1( INS_ARG )
{
CUR.GS.rp1 = (Int)(args[0]);
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,337
|
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);
}
|
DoS
| 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);
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,338
|
static void Ins_SSWCI( INS_ARG )
{
CUR.GS.single_width_cutin = (TT_F26Dot6)args[0];
}
|
DoS
| 0
|
static void Ins_SSWCI( INS_ARG )
{
CUR.GS.single_width_cutin = (TT_F26Dot6)args[0];
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,339
|
static void Ins_SUB( INS_ARG )
{ (void)exc;
args[0] -= args[1];
}
|
DoS
| 0
|
static void Ins_SUB( INS_ARG )
{ (void)exc;
args[0] -= args[1];
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,340
|
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();
}
|
DoS
| 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();
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,341
|
static void Ins_SWAP( INS_ARG )
{
Long L;
(void)exc;
L = args[0];
args[0] = args[1];
args[1] = L;
}
|
DoS
| 0
|
static void Ins_SWAP( INS_ARG )
{
Long L;
(void)exc;
L = args[0];
args[0] = args[1];
args[1] = L;
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,342
|
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]);
}
|
DoS
| 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]);
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,343
|
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]);
}
|
DoS
| 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]);
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,344
|
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;
}
|
DoS
| 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;
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,345
|
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;
}
|
DoS
| 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;
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,346
|
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;
}
|
DoS
| 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;
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,347
|
static void Ins_WCVTF( INS_ARG )
{
#ifdef DEBUG
int ov;
#endif
if ( BOUNDS( args[0], CUR.cvtSize ) )
{
CUR.error = TT_Err_Invalid_Reference;
return;
}
#ifdef DEBUG
ov = CUR.cvt[args[0]];
#endif
CUR.cvt[args[0]] = FUnits_To_Pixels( EXEC_ARGS args[1] );
#ifdef DEBUG
DBG_PRINT3(" cvt[%d]%d:=%d", args[0], ov, CUR.cvt[args[0]]);
#endif
}
|
DoS
| 0
|
static void Ins_WCVTF( INS_ARG )
{
#ifdef DEBUG
int ov;
#endif
if ( BOUNDS( args[0], CUR.cvtSize ) )
{
CUR.error = TT_Err_Invalid_Reference;
return;
}
#ifdef DEBUG
ov = CUR.cvt[args[0]];
#endif
CUR.cvt[args[0]] = FUnits_To_Pixels( EXEC_ARGS args[1] );
#ifdef DEBUG
DBG_PRINT3(" cvt[%d]%d:=%d", args[0], ov, CUR.cvt[args[0]]);
#endif
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,348
|
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];
}
|
DoS
| 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];
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,349
|
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;
}
}
|
DoS
| 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;
}
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,350
|
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]);
}
|
DoS
| 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]);
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,351
|
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;
}
}
|
DoS
| 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;
}
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,352
|
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;
}
|
DoS
| 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;
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,353
|
static TT_F26Dot6 Project( EXEC_OPS TT_F26Dot6 Vx, TT_F26Dot6 Vy )
{
THROW_PATENTED;
return 0;
}
|
DoS
| 0
|
static TT_F26Dot6 Project( EXEC_OPS TT_F26Dot6 Vx, TT_F26Dot6 Vy )
{
THROW_PATENTED;
return 0;
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,354
|
static TT_F26Dot6 Read_CVT( EXEC_OPS Int index )
{
return CUR.cvt[index];
}
|
DoS
| 0
|
static TT_F26Dot6 Read_CVT( EXEC_OPS Int index )
{
return CUR.cvt[index];
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,355
|
static TT_F26Dot6 Read_CVT_Stretched( EXEC_OPS Int index )
{
return MulDiv_Round( CUR.cvt[index], CURRENT_Ratio(), 0x10000 );
}
|
DoS
| 0
|
static TT_F26Dot6 Read_CVT_Stretched( EXEC_OPS Int index )
{
return MulDiv_Round( CUR.cvt[index], CURRENT_Ratio(), 0x10000 );
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,356
|
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;
}
|
DoS
| 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;
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,357
|
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;
}
|
DoS
| 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;
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,358
|
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;
}
|
DoS
| 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;
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,359
|
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;
}
|
DoS
| 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;
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,360
|
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;
}
|
DoS
| 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;
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,361
|
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;
}
|
DoS
| 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;
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,362
|
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;
}
|
DoS
| 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;
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,363
|
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]);
}
|
DoS
| 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]);
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,364
|
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;
}
}
}
|
DoS
| 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;
}
}
}
|
@@ -1794,6 +1794,12 @@ static int nInstrCount=0;
static void Ins_JMPR( INS_ARG )
{
+ if ( BOUNDS(CUR.IP + args[0], CUR.codeSize ) )
+ {
+ CUR.error = TT_Err_Invalid_Reference;
+ return;
+ }
+
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
|
CWE-125
| null | null |
4,365
|
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;
}
|
DoS
| 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;
}
|
@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n)
if (!r->error) {
if (r->extra_glyph_index != -1) {
q = r->glyph_data.bits.data + r->pos;
- r->error = (r->glyph_data.bits.size - r->pos < n ?
+ r->error = ((r->pos >= r->glyph_data.bits.size ||
+ r->glyph_data.bits.size - r->pos < n) ?
gs_note_error(gs_error_invalidfont) : 0);
if (r->error == 0)
memcpy(p, q, n);
|
CWE-125
| null | null |
4,366
|
static void DebugRepaint(ttfFont *ttf)
{
}
|
DoS
| 0
|
static void DebugRepaint(ttfFont *ttf)
{
}
|
@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n)
if (!r->error) {
if (r->extra_glyph_index != -1) {
q = r->glyph_data.bits.data + r->pos;
- r->error = (r->glyph_data.bits.size - r->pos < n ?
+ r->error = ((r->pos >= r->glyph_data.bits.size ||
+ r->glyph_data.bits.size - r->pos < n) ?
gs_note_error(gs_error_invalidfont) : 0);
if (r->error == 0)
memcpy(p, q, n);
|
CWE-125
| null | null |
4,367
|
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;
}
|
DoS
| 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;
}
|
@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n)
if (!r->error) {
if (r->extra_glyph_index != -1) {
q = r->glyph_data.bits.data + r->pos;
- r->error = (r->glyph_data.bits.size - r->pos < n ?
+ r->error = ((r->pos >= r->glyph_data.bits.size ||
+ r->glyph_data.bits.size - r->pos < n) ?
gs_note_error(gs_error_invalidfont) : 0);
if (r->error == 0)
memcpy(p, q, n);
|
CWE-125
| null | null |
4,368
|
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;
}
}
|
DoS
| 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;
}
}
|
@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n)
if (!r->error) {
if (r->extra_glyph_index != -1) {
q = r->glyph_data.bits.data + r->pos;
- r->error = (r->glyph_data.bits.size - r->pos < n ?
+ r->error = ((r->pos >= r->glyph_data.bits.size ||
+ r->glyph_data.bits.size - r->pos < n) ?
gs_note_error(gs_error_invalidfont) : 0);
if (r->error == 0)
memcpy(p, q, n);
|
CWE-125
| null | null |
4,369
|
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;
}
}
}
|
DoS
| 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;
}
}
}
|
@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n)
if (!r->error) {
if (r->extra_glyph_index != -1) {
q = r->glyph_data.bits.data + r->pos;
- r->error = (r->glyph_data.bits.size - r->pos < n ?
+ r->error = ((r->pos >= r->glyph_data.bits.size ||
+ r->glyph_data.bits.size - r->pos < n) ?
gs_note_error(gs_error_invalidfont) : 0);
if (r->error == 0)
memcpy(p, q, n);
|
CWE-125
| null | null |
4,370
|
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;
}
|
DoS
| 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;
}
|
@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n)
if (!r->error) {
if (r->extra_glyph_index != -1) {
q = r->glyph_data.bits.data + r->pos;
- r->error = (r->glyph_data.bits.size - r->pos < n ?
+ r->error = ((r->pos >= r->glyph_data.bits.size ||
+ r->glyph_data.bits.size - r->pos < n) ?
gs_note_error(gs_error_invalidfont) : 0);
if (r->error == 0)
memcpy(p, q, n);
|
CWE-125
| null | null |
4,371
|
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, ¶ms, &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;
}
|
DoS
| 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, ¶ms, &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;
}
|
@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n)
if (!r->error) {
if (r->extra_glyph_index != -1) {
q = r->glyph_data.bits.data + r->pos;
- r->error = (r->glyph_data.bits.size - r->pos < n ?
+ r->error = ((r->pos >= r->glyph_data.bits.size ||
+ r->glyph_data.bits.size - r->pos < n) ?
gs_note_error(gs_error_invalidfont) : 0);
if (r->error == 0)
memcpy(p, q, n);
|
CWE-125
| null | null |
4,372
|
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);
}
|
DoS
| 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);
}
|
@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n)
if (!r->error) {
if (r->extra_glyph_index != -1) {
q = r->glyph_data.bits.data + r->pos;
- r->error = (r->glyph_data.bits.size - r->pos < n ?
+ r->error = ((r->pos >= r->glyph_data.bits.size ||
+ r->glyph_data.bits.size - r->pos < n) ?
gs_note_error(gs_error_invalidfont) : 0);
if (r->error == 0)
memcpy(p, q, n);
|
CWE-125
| null | null |
4,373
|
static void gx_ttfExport__DebugPaint(ttfExport *self)
{
}
|
DoS
| 0
|
static void gx_ttfExport__DebugPaint(ttfExport *self)
{
}
|
@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n)
if (!r->error) {
if (r->extra_glyph_index != -1) {
q = r->glyph_data.bits.data + r->pos;
- r->error = (r->glyph_data.bits.size - r->pos < n ?
+ r->error = ((r->pos >= r->glyph_data.bits.size ||
+ r->glyph_data.bits.size - r->pos < n) ?
gs_note_error(gs_error_invalidfont) : 0);
if (r->error == 0)
memcpy(p, q, n);
|
CWE-125
| null | null |
4,374
|
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);
}
|
DoS
| 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);
}
|
@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n)
if (!r->error) {
if (r->extra_glyph_index != -1) {
q = r->glyph_data.bits.data + r->pos;
- r->error = (r->glyph_data.bits.size - r->pos < n ?
+ r->error = ((r->pos >= r->glyph_data.bits.size ||
+ r->glyph_data.bits.size - r->pos < n) ?
gs_note_error(gs_error_invalidfont) : 0);
if (r->error == 0)
memcpy(p, q, n);
|
CWE-125
| null | null |
4,375
|
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));
}
|
DoS
| 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));
}
|
@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n)
if (!r->error) {
if (r->extra_glyph_index != -1) {
q = r->glyph_data.bits.data + r->pos;
- r->error = (r->glyph_data.bits.size - r->pos < n ?
+ r->error = ((r->pos >= r->glyph_data.bits.size ||
+ r->glyph_data.bits.size - r->pos < n) ?
gs_note_error(gs_error_invalidfont) : 0);
if (r->error == 0)
memcpy(p, q, n);
|
CWE-125
| null | null |
4,376
|
static void gx_ttfExport__Point(ttfExport *self, FloatPoint *p, bool bOnCurve, bool bNewPath)
{
/* Never called. */
}
|
DoS
| 0
|
static void gx_ttfExport__Point(ttfExport *self, FloatPoint *p, bool bOnCurve, bool bNewPath)
{
/* Never called. */
}
|
@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n)
if (!r->error) {
if (r->extra_glyph_index != -1) {
q = r->glyph_data.bits.data + r->pos;
- r->error = (r->glyph_data.bits.size - r->pos < n ?
+ r->error = ((r->pos >= r->glyph_data.bits.size ||
+ r->glyph_data.bits.size - r->pos < n) ?
gs_note_error(gs_error_invalidfont) : 0);
if (r->error == 0)
memcpy(p, q, n);
|
CWE-125
| null | null |
4,377
|
static void gx_ttfExport__SetWidth(ttfExport *self, FloatPoint *p)
{
gx_ttfExport *e = (gx_ttfExport *)self;
e->w.x = float2fixed(p->x);
e->w.y = float2fixed(p->y);
}
|
DoS
| 0
|
static void gx_ttfExport__SetWidth(ttfExport *self, FloatPoint *p)
{
gx_ttfExport *e = (gx_ttfExport *)self;
e->w.x = float2fixed(p->x);
e->w.y = float2fixed(p->y);
}
|
@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n)
if (!r->error) {
if (r->extra_glyph_index != -1) {
q = r->glyph_data.bits.data + r->pos;
- r->error = (r->glyph_data.bits.size - r->pos < n ?
+ r->error = ((r->pos >= r->glyph_data.bits.size ||
+ r->glyph_data.bits.size - r->pos < n) ?
gs_note_error(gs_error_invalidfont) : 0);
if (r->error == 0)
memcpy(p, q, n);
|
CWE-125
| null | null |
4,378
|
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);
}
|
DoS
| 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);
}
|
@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n)
if (!r->error) {
if (r->extra_glyph_index != -1) {
q = r->glyph_data.bits.data + r->pos;
- r->error = (r->glyph_data.bits.size - r->pos < n ?
+ r->error = ((r->pos >= r->glyph_data.bits.size ||
+ r->glyph_data.bits.size - r->pos < n) ?
gs_note_error(gs_error_invalidfont) : 0);
if (r->error == 0)
memcpy(p, q, n);
|
CWE-125
| null | null |
4,379
|
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);
}
|
DoS
| 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);
}
|
@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n)
if (!r->error) {
if (r->extra_glyph_index != -1) {
q = r->glyph_data.bits.data + r->pos;
- r->error = (r->glyph_data.bits.size - r->pos < n ?
+ r->error = ((r->pos >= r->glyph_data.bits.size ||
+ r->glyph_data.bits.size - r->pos < n) ?
gs_note_error(gs_error_invalidfont) : 0);
if (r->error == 0)
memcpy(p, q, n);
|
CWE-125
| null | null |
4,380
|
static void gx_ttfMemory__free(ttfMemory *self, void *p, const char *cname)
{
gs_memory_t *mem = ((gx_ttfMemory *)self)->memory;
gs_free_object(mem, p, cname);
}
|
DoS
| 0
|
static void gx_ttfMemory__free(ttfMemory *self, void *p, const char *cname)
{
gs_memory_t *mem = ((gx_ttfMemory *)self)->memory;
gs_free_object(mem, p, cname);
}
|
@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n)
if (!r->error) {
if (r->extra_glyph_index != -1) {
q = r->glyph_data.bits.data + r->pos;
- r->error = (r->glyph_data.bits.size - r->pos < n ?
+ r->error = ((r->pos >= r->glyph_data.bits.size ||
+ r->glyph_data.bits.size - r->pos < n) ?
gs_note_error(gs_error_invalidfont) : 0);
if (r->error == 0)
memcpy(p, q, n);
|
CWE-125
| null | null |
4,381
|
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;
}
|
DoS
| 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;
}
|
@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n)
if (!r->error) {
if (r->extra_glyph_index != -1) {
q = r->glyph_data.bits.data + r->pos;
- r->error = (r->glyph_data.bits.size - r->pos < n ?
+ r->error = ((r->pos >= r->glyph_data.bits.size ||
+ r->glyph_data.bits.size - r->pos < n) ?
gs_note_error(gs_error_invalidfont) : 0);
if (r->error == 0)
memcpy(p, q, n);
|
CWE-125
| null | null |
4,382
|
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 */
}
|
DoS
| 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 */
}
|
@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n)
if (!r->error) {
if (r->extra_glyph_index != -1) {
q = r->glyph_data.bits.data + r->pos;
- r->error = (r->glyph_data.bits.size - r->pos < n ?
+ r->error = ((r->pos >= r->glyph_data.bits.size ||
+ r->glyph_data.bits.size - r->pos < n) ?
gs_note_error(gs_error_invalidfont) : 0);
if (r->error == 0)
memcpy(p, q, n);
|
CWE-125
| null | null |
4,383
|
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");
}
|
DoS
| 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");
}
|
@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n)
if (!r->error) {
if (r->extra_glyph_index != -1) {
q = r->glyph_data.bits.data + r->pos;
- r->error = (r->glyph_data.bits.size - r->pos < n ?
+ r->error = ((r->pos >= r->glyph_data.bits.size ||
+ r->glyph_data.bits.size - r->pos < n) ?
gs_note_error(gs_error_invalidfont) : 0);
if (r->error == 0)
memcpy(p, q, n);
|
CWE-125
| null | null |
4,384
|
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;
}
|
DoS
| 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;
}
|
@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n)
if (!r->error) {
if (r->extra_glyph_index != -1) {
q = r->glyph_data.bits.data + r->pos;
- r->error = (r->glyph_data.bits.size - r->pos < n ?
+ r->error = ((r->pos >= r->glyph_data.bits.size ||
+ r->glyph_data.bits.size - r->pos < n) ?
gs_note_error(gs_error_invalidfont) : 0);
if (r->error == 0)
memcpy(p, q, n);
|
CWE-125
| null | null |
4,385
|
static void gx_ttfReader__Seek(ttfReader *self, int nPos)
{
gx_ttfReader *r = (gx_ttfReader *)self;
r->pos = nPos;
}
|
DoS
| 0
|
static void gx_ttfReader__Seek(ttfReader *self, int nPos)
{
gx_ttfReader *r = (gx_ttfReader *)self;
r->pos = nPos;
}
|
@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n)
if (!r->error) {
if (r->extra_glyph_index != -1) {
q = r->glyph_data.bits.data + r->pos;
- r->error = (r->glyph_data.bits.size - r->pos < n ?
+ r->error = ((r->pos >= r->glyph_data.bits.size ||
+ r->glyph_data.bits.size - r->pos < n) ?
gs_note_error(gs_error_invalidfont) : 0);
if (r->error == 0)
memcpy(p, q, n);
|
CWE-125
| null | null |
4,386
|
static int gx_ttfReader__Tell(ttfReader *self)
{
gx_ttfReader *r = (gx_ttfReader *)self;
return r->pos;
}
|
DoS
| 0
|
static int gx_ttfReader__Tell(ttfReader *self)
{
gx_ttfReader *r = (gx_ttfReader *)self;
return r->pos;
}
|
@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n)
if (!r->error) {
if (r->extra_glyph_index != -1) {
q = r->glyph_data.bits.data + r->pos;
- r->error = (r->glyph_data.bits.size - r->pos < n ?
+ r->error = ((r->pos >= r->glyph_data.bits.size ||
+ r->glyph_data.bits.size - r->pos < n) ?
gs_note_error(gs_error_invalidfont) : 0);
if (r->error == 0)
memcpy(p, q, n);
|
CWE-125
| null | null |
4,387
|
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;
}
|
DoS
| 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;
}
|
@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n)
if (!r->error) {
if (r->extra_glyph_index != -1) {
q = r->glyph_data.bits.data + r->pos;
- r->error = (r->glyph_data.bits.size - r->pos < n ?
+ r->error = ((r->pos >= r->glyph_data.bits.size ||
+ r->glyph_data.bits.size - r->pos < n) ?
gs_note_error(gs_error_invalidfont) : 0);
if (r->error == 0)
memcpy(p, q, n);
|
CWE-125
| null | null |
4,388
|
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;
}
|
DoS
| 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;
}
|
@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n)
if (!r->error) {
if (r->extra_glyph_index != -1) {
q = r->glyph_data.bits.data + r->pos;
- r->error = (r->glyph_data.bits.size - r->pos < n ?
+ r->error = ((r->pos >= r->glyph_data.bits.size ||
+ r->glyph_data.bits.size - r->pos < n) ?
gs_note_error(gs_error_invalidfont) : 0);
if (r->error == 0)
memcpy(p, q, n);
|
CWE-125
| null | null |
4,389
|
void gx_ttfReader__destroy(gx_ttfReader *self)
{
gs_free_object(self->memory, self, "gx_ttfReader__destroy");
}
|
DoS
| 0
|
void gx_ttfReader__destroy(gx_ttfReader *self)
{
gs_free_object(self->memory, self, "gx_ttfReader__destroy");
}
|
@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n)
if (!r->error) {
if (r->extra_glyph_index != -1) {
q = r->glyph_data.bits.data + r->pos;
- r->error = (r->glyph_data.bits.size - r->pos < n ?
+ r->error = ((r->pos >= r->glyph_data.bits.size ||
+ r->glyph_data.bits.size - r->pos < n) ?
gs_note_error(gs_error_invalidfont) : 0);
if (r->error == 0)
memcpy(p, q, n);
|
CWE-125
| null | null |
4,390
|
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);
}
}
}
|
DoS
| 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);
}
}
}
|
@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n)
if (!r->error) {
if (r->extra_glyph_index != -1) {
q = r->glyph_data.bits.data + r->pos;
- r->error = (r->glyph_data.bits.size - r->pos < n ?
+ r->error = ((r->pos >= r->glyph_data.bits.size ||
+ r->glyph_data.bits.size - r->pos < n) ?
gs_note_error(gs_error_invalidfont) : 0);
if (r->error == 0)
memcpy(p, q, n);
|
CWE-125
| null | null |
4,391
|
static inline float reminder(float v, int x)
{
return ((v / x) - floor(v / x)) * x;
}
|
DoS
| 0
|
static inline float reminder(float v, int x)
{
return ((v / x) - floor(v / x)) * x;
}
|
@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n)
if (!r->error) {
if (r->extra_glyph_index != -1) {
q = r->glyph_data.bits.data + r->pos;
- r->error = (r->glyph_data.bits.size - r->pos < n ?
+ r->error = ((r->pos >= r->glyph_data.bits.size ||
+ r->glyph_data.bits.size - r->pos < n) ?
gs_note_error(gs_error_invalidfont) : 0);
if (r->error == 0)
memcpy(p, q, n);
|
CWE-125
| null | null |
4,392
|
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);
}
|
DoS
| 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);
}
|
@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n)
if (!r->error) {
if (r->extra_glyph_index != -1) {
q = r->glyph_data.bits.data + r->pos;
- r->error = (r->glyph_data.bits.size - r->pos < n ?
+ r->error = ((r->pos >= r->glyph_data.bits.size ||
+ r->glyph_data.bits.size - r->pos < n) ?
gs_note_error(gs_error_invalidfont) : 0);
if (r->error == 0)
memcpy(p, q, n);
|
CWE-125
| null | null |
4,393
|
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);
}
}
|
DoS
| 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);
}
}
|
@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n)
if (!r->error) {
if (r->extra_glyph_index != -1) {
q = r->glyph_data.bits.data + r->pos;
- r->error = (r->glyph_data.bits.size - r->pos < n ?
+ r->error = ((r->pos >= r->glyph_data.bits.size ||
+ r->glyph_data.bits.size - r->pos < n) ?
gs_note_error(gs_error_invalidfont) : 0);
if (r->error == 0)
memcpy(p, q, n);
|
CWE-125
| null | null |
4,394
|
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);
}
}
}
|
DoS
| 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);
}
}
}
|
@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n)
if (!r->error) {
if (r->extra_glyph_index != -1) {
q = r->glyph_data.bits.data + r->pos;
- r->error = (r->glyph_data.bits.size - r->pos < n ?
+ r->error = ((r->pos >= r->glyph_data.bits.size ||
+ r->glyph_data.bits.size - r->pos < n) ?
gs_note_error(gs_error_invalidfont) : 0);
if (r->error == 0)
memcpy(p, q, n);
|
CWE-125
| null | null |
4,395
|
ttfFont *ttfFont__create(gs_font_dir *dir)
{
gs_memory_t *mem = dir->memory->stable_memory;
ttfFont *ttf;
if (dir->ttm == NULL) {
gx_ttfMemory *m = gs_alloc_struct(mem, gx_ttfMemory, &st_gx_ttfMemory, "ttfFont__create(gx_ttfMemory)");
if (!m)
return 0;
m->super.alloc_struct = gx_ttfMemory__alloc_struct;
m->super.alloc_bytes = gx_ttfMemory__alloc_bytes;
m->super.free = gx_ttfMemory__free;
m->memory = mem;
dir->ttm = m;
}
if(ttfInterpreter__obtain(&dir->ttm->super, &dir->tti))
return 0;
if(gx_san__obtain(mem, &dir->san))
return 0;
ttf = gs_alloc_struct(mem, ttfFont, &st_ttfFont, "ttfFont__create");
if (ttf == NULL)
return 0;
#ifdef DEBUG
ttfFont__init(ttf, &dir->ttm->super, DebugRepaint,
(gs_debug_c('Y') ? DebugPrint : NULL), mem);
#else
ttfFont__init(ttf, &dir->ttm->super, DebugRepaint, NULL, mem);
#endif
return ttf;
}
|
DoS
| 0
|
ttfFont *ttfFont__create(gs_font_dir *dir)
{
gs_memory_t *mem = dir->memory->stable_memory;
ttfFont *ttf;
if (dir->ttm == NULL) {
gx_ttfMemory *m = gs_alloc_struct(mem, gx_ttfMemory, &st_gx_ttfMemory, "ttfFont__create(gx_ttfMemory)");
if (!m)
return 0;
m->super.alloc_struct = gx_ttfMemory__alloc_struct;
m->super.alloc_bytes = gx_ttfMemory__alloc_bytes;
m->super.free = gx_ttfMemory__free;
m->memory = mem;
dir->ttm = m;
}
if(ttfInterpreter__obtain(&dir->ttm->super, &dir->tti))
return 0;
if(gx_san__obtain(mem, &dir->san))
return 0;
ttf = gs_alloc_struct(mem, ttfFont, &st_ttfFont, "ttfFont__create");
if (ttf == NULL)
return 0;
#ifdef DEBUG
ttfFont__init(ttf, &dir->ttm->super, DebugRepaint,
(gs_debug_c('Y') ? DebugPrint : NULL), mem);
#else
ttfFont__init(ttf, &dir->ttm->super, DebugRepaint, NULL, mem);
#endif
return ttf;
}
|
@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n)
if (!r->error) {
if (r->extra_glyph_index != -1) {
q = r->glyph_data.bits.data + r->pos;
- r->error = (r->glyph_data.bits.size - r->pos < n ?
+ r->error = ((r->pos >= r->glyph_data.bits.size ||
+ r->glyph_data.bits.size - r->pos < n) ?
gs_note_error(gs_error_invalidfont) : 0);
if (r->error == 0)
memcpy(p, q, n);
|
CWE-125
| null | null |
4,396
|
void ttfFont__destroy(ttfFont *self, gs_font_dir *dir)
{
gs_memory_t *mem = dir->memory->stable_memory;
ttfFont__finit(self);
gs_free_object(mem, self, "ttfFont__destroy");
ttfInterpreter__release(&dir->tti);
gx_san__release(&dir->san);
if (dir->tti == NULL && dir->ttm != NULL) {
gs_free_object(mem, dir->ttm, "ttfFont__destroy(gx_ttfMemory)");
dir->ttm = NULL;
}
}
|
DoS
| 0
|
void ttfFont__destroy(ttfFont *self, gs_font_dir *dir)
{
gs_memory_t *mem = dir->memory->stable_memory;
ttfFont__finit(self);
gs_free_object(mem, self, "ttfFont__destroy");
ttfInterpreter__release(&dir->tti);
gx_san__release(&dir->san);
if (dir->tti == NULL && dir->ttm != NULL) {
gs_free_object(mem, dir->ttm, "ttfFont__destroy(gx_ttfMemory)");
dir->ttm = NULL;
}
}
|
@@ -79,7 +79,8 @@ static void gx_ttfReader__Read(ttfReader *self, void *p, int n)
if (!r->error) {
if (r->extra_glyph_index != -1) {
q = r->glyph_data.bits.data + r->pos;
- r->error = (r->glyph_data.bits.size - r->pos < n ?
+ r->error = ((r->pos >= r->glyph_data.bits.size ||
+ r->glyph_data.bits.size - r->pos < n) ?
gs_note_error(gs_error_invalidfont) : 0);
if (r->error == 0)
memcpy(p, q, n);
|
CWE-125
| null | null |
4,397
|
static void Ins_JMPR( INS_ARG )
{
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
if(CUR.IP > CUR.codeSize ||
(CUR.code[CUR.IP] != 0x2D && CUR.code[CUR.IP - 1] == 0x2D))
/* The JPMR is meant to stop at the ENDF instruction to finish
* the function. However the programmer made a mistake, and ended
* up one byte too far. I suspect that some TT interpreters handle this
* by detecting that the IP has gone off the end of the function. We can
* allow for simple cases here by just checking the preceding byte.
* Fonts with this problem are not uncommon.
*/
CUR.IP -= 1;
}
|
DoS
| 0
|
static void Ins_JMPR( INS_ARG )
{
CUR.IP += (Int)(args[0]);
CUR.step_ins = FALSE;
if(CUR.IP > CUR.codeSize ||
(CUR.code[CUR.IP] != 0x2D && CUR.code[CUR.IP - 1] == 0x2D))
/* The JPMR is meant to stop at the ENDF instruction to finish
* the function. However the programmer made a mistake, and ended
* up one byte too far. I suspect that some TT interpreters handle this
* by detecting that the IP has gone off the end of the function. We can
* allow for simple cases here by just checking the preceding byte.
* Fonts with this problem are not uncommon.
*/
CUR.IP -= 1;
}
|
@@ -3770,7 +3770,8 @@ static int nInstrCount=0;
point = (Int)args[0];
- if ( BOUNDS( args[0], CUR.zp1.n_points ) )
+ if ( BOUNDS( args[0], CUR.zp1.n_points ) ||
+ BOUNDS( CUR.GS.rp0, CUR.zp0.n_points) )
{
/* Current version of FreeType silently ignores this out of bounds error
* and drops the instruction, see bug #691121
|
CWE-125
| null | null |
4,398
|
dbus_g_proxy_manager_monitor_name_owner (DBusGProxyManager *manager,
const char *owner,
const char *name)
{
GSList *names;
GSList *link;
DBusGProxyNameOwnerInfo *nameinfo;
names = g_hash_table_lookup (manager->owner_names, owner);
link = g_slist_find_custom (names, name, find_name_in_info);
if (!link)
{
nameinfo = g_new0 (DBusGProxyNameOwnerInfo, 1);
nameinfo->name = g_strdup (name);
nameinfo->refcount = 1;
insert_nameinfo (manager, owner, nameinfo);
}
else
{
nameinfo = link->data;
nameinfo->refcount++;
}
}
|
+Priv
| 0
|
dbus_g_proxy_manager_monitor_name_owner (DBusGProxyManager *manager,
const char *owner,
const char *name)
{
GSList *names;
GSList *link;
DBusGProxyNameOwnerInfo *nameinfo;
names = g_hash_table_lookup (manager->owner_names, owner);
link = g_slist_find_custom (names, name, find_name_in_info);
if (!link)
{
nameinfo = g_new0 (DBusGProxyNameOwnerInfo, 1);
nameinfo->name = g_strdup (name);
nameinfo->refcount = 1;
insert_nameinfo (manager, owner, nameinfo);
}
else
{
nameinfo = link->data;
nameinfo->refcount++;
}
}
|
@@ -1250,8 +1250,11 @@ dbus_g_proxy_manager_filter (DBusConnection *connection,
GSList *tmp;
const char *sender;
+ sender = dbus_message_get_sender (message);
+
/* First we handle NameOwnerChanged internally */
- if (dbus_message_is_signal (message,
+ if (g_strcmp0 (sender, DBUS_SERVICE_DBUS) == 0 &&
+ dbus_message_is_signal (message,
DBUS_INTERFACE_DBUS,
"NameOwnerChanged"))
{
@@ -1280,8 +1283,6 @@ dbus_g_proxy_manager_filter (DBusConnection *connection,
}
}
- sender = dbus_message_get_sender (message);
-
/* dbus spec requires these, libdbus validates */
g_assert (dbus_message_get_path (message) != NULL);
g_assert (dbus_message_get_interface (message) != NULL);
|
CWE-20
| null | null |
4,399
|
dbus_g_proxy_manager_replace_name_owner (DBusGProxyManager *manager,
const char *name,
const char *prev_owner,
const char *new_owner)
{
GSList *names;
if (prev_owner[0] == '\0')
{
GSList *tmp;
GSList *removed;
/* We have a new service, look at unassociated proxies */
removed = NULL;
for (tmp = manager->unassociated_proxies; tmp ; tmp = tmp->next)
{
DBusGProxy *proxy = tmp->data;
DBusGProxyPrivate *priv = DBUS_G_PROXY_GET_PRIVATE(proxy);
if (!strcmp (priv->name, name))
{
removed = g_slist_prepend (removed, tmp);
dbus_g_proxy_manager_monitor_name_owner (manager, new_owner, name);
priv->associated = TRUE;
}
}
for (tmp = removed; tmp; tmp = tmp->next)
manager->unassociated_proxies = g_slist_delete_link (manager->unassociated_proxies, tmp->data);
g_slist_free (removed);
}
else
{
DBusGProxyNameOwnerInfo *info;
GSList *link;
/* Name owner changed or deleted */
names = g_hash_table_lookup (manager->owner_names, prev_owner);
info = NULL;
if (names != NULL)
{
link = g_slist_find_custom (names, name, find_name_in_info);
if (link != NULL)
{
info = link->data;
names = g_slist_delete_link (names, link);
if (names == NULL)
{
g_hash_table_remove (manager->owner_names, prev_owner);
}
else
{
g_hash_table_insert (manager->owner_names,
g_strdup (prev_owner), names);
}
}
}
if (new_owner[0] == '\0')
{
DBusGProxyUnassociateData data;
GSList *tmp;
data.name = name;
data.destroyed = NULL;
/* A service went away, we need to unassociate proxies */
g_hash_table_foreach (manager->proxy_lists,
unassociate_proxies, &data);
UNLOCK_MANAGER (manager);
/* the destroyed list's data pointers are weak pointers, so that we
* don't end up calling destroy on proxies which have already been
* freed up as a result of other ones being destroyed */
for (tmp = data.destroyed; tmp; tmp = tmp->next)
if (tmp->data != NULL)
{
g_object_remove_weak_pointer (G_OBJECT (tmp->data),
&(tmp->data));
dbus_g_proxy_destroy (tmp->data);
}
g_slist_free (data.destroyed);
LOCK_MANAGER (manager);
if (info)
{
g_free (info->name);
g_free (info);
}
}
else if (info)
{
insert_nameinfo (manager, new_owner, info);
}
}
}
|
+Priv
| 0
|
dbus_g_proxy_manager_replace_name_owner (DBusGProxyManager *manager,
const char *name,
const char *prev_owner,
const char *new_owner)
{
GSList *names;
if (prev_owner[0] == '\0')
{
GSList *tmp;
GSList *removed;
/* We have a new service, look at unassociated proxies */
removed = NULL;
for (tmp = manager->unassociated_proxies; tmp ; tmp = tmp->next)
{
DBusGProxy *proxy = tmp->data;
DBusGProxyPrivate *priv = DBUS_G_PROXY_GET_PRIVATE(proxy);
if (!strcmp (priv->name, name))
{
removed = g_slist_prepend (removed, tmp);
dbus_g_proxy_manager_monitor_name_owner (manager, new_owner, name);
priv->associated = TRUE;
}
}
for (tmp = removed; tmp; tmp = tmp->next)
manager->unassociated_proxies = g_slist_delete_link (manager->unassociated_proxies, tmp->data);
g_slist_free (removed);
}
else
{
DBusGProxyNameOwnerInfo *info;
GSList *link;
/* Name owner changed or deleted */
names = g_hash_table_lookup (manager->owner_names, prev_owner);
info = NULL;
if (names != NULL)
{
link = g_slist_find_custom (names, name, find_name_in_info);
if (link != NULL)
{
info = link->data;
names = g_slist_delete_link (names, link);
if (names == NULL)
{
g_hash_table_remove (manager->owner_names, prev_owner);
}
else
{
g_hash_table_insert (manager->owner_names,
g_strdup (prev_owner), names);
}
}
}
if (new_owner[0] == '\0')
{
DBusGProxyUnassociateData data;
GSList *tmp;
data.name = name;
data.destroyed = NULL;
/* A service went away, we need to unassociate proxies */
g_hash_table_foreach (manager->proxy_lists,
unassociate_proxies, &data);
UNLOCK_MANAGER (manager);
/* the destroyed list's data pointers are weak pointers, so that we
* don't end up calling destroy on proxies which have already been
* freed up as a result of other ones being destroyed */
for (tmp = data.destroyed; tmp; tmp = tmp->next)
if (tmp->data != NULL)
{
g_object_remove_weak_pointer (G_OBJECT (tmp->data),
&(tmp->data));
dbus_g_proxy_destroy (tmp->data);
}
g_slist_free (data.destroyed);
LOCK_MANAGER (manager);
if (info)
{
g_free (info->name);
g_free (info);
}
}
else if (info)
{
insert_nameinfo (manager, new_owner, info);
}
}
}
|
@@ -1250,8 +1250,11 @@ dbus_g_proxy_manager_filter (DBusConnection *connection,
GSList *tmp;
const char *sender;
+ sender = dbus_message_get_sender (message);
+
/* First we handle NameOwnerChanged internally */
- if (dbus_message_is_signal (message,
+ if (g_strcmp0 (sender, DBUS_SERVICE_DBUS) == 0 &&
+ dbus_message_is_signal (message,
DBUS_INTERFACE_DBUS,
"NameOwnerChanged"))
{
@@ -1280,8 +1283,6 @@ dbus_g_proxy_manager_filter (DBusConnection *connection,
}
}
- sender = dbus_message_get_sender (message);
-
/* dbus spec requires these, libdbus validates */
g_assert (dbus_message_get_path (message) != NULL);
g_assert (dbus_message_get_interface (message) != NULL);
|
CWE-20
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.