Changeset 638 in dev for trunk


Ignore:
Timestamp:
Jun 12, 2008, 11:02:32 PM (16 years ago)
Author:
dai_9181
Message:

配列範囲外にアクセスしてしまう危険性があったので修正。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/abdev/BasicCompiler_Common/NumOpe_GetType.cpp

    r632 r638  
    193193}
    194194
    195 int GetReturnType_OperatorProc(int idCalc,const Type &baseType,int *type_stack,LONG_PTR *index_stack,int &sp){
     195int GetReturnType_OperatorProc(int idCalc,const Type &baseType,int *type_stack,LONG_PTR *index_stack,int &sp)
     196{
     197    if( sp < 2 )
     198    {
     199        Jenga::Throw( "GetReturnType_OperatorProcのspが2以下" );
     200    }
     201
    196202    Type leftType( type_stack[sp-2], index_stack[sp-2] );
    197203    Type rightType( type_stack[sp-1] & (~FLAG_CAST), index_stack[sp-1] );
     
    708714        idCalc=calc[i]%100;
    709715
    710         if(idCalc){
     716        if(idCalc && sp >= 2){
    711717            if(type_stack[sp-2]==DEF_OBJECT){
    712718                if( idCalc == CALC_AS
Note: See TracChangeset for help on using the changeset viewer.