Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 32993 Details for
Bug 123787
[Patch] Apply Patch error handling for invalid formats
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
The patch that's used
lvtt.pat (text/plain), 14.94 KB, created by
Navid Mehregani
on 2006-01-13 11:55:43 EST
(
hide
)
Description:
The patch that's used
Filename:
MIME Type:
Creator:
Navid Mehregani
Created:
2006-01-13 11:55:43 EST
Size:
14.94 KB
patch
obsolete
>*** BCI\JClass\JClassFile.cpp@@\main\baltic\0 Tue Dec 13 15:02:30 2005 >--- BCI\JClass\JClassFile.cpp Wed Dec 14 13:43:48 2005 >*************** >*** 1717,1722 **** >--- 1717,1726 ---- > { > pCurrent = new CLocalVariableTableAttribute(m_pClassFile); > } >+ else if(*pcpUtf8 == "LocalVariableTypeTable") >+ { >+ pCurrent = new CLocalVariableTypeTableAttribute(m_pClassFile); >+ } > else if(*pcpUtf8 == "Exceptions") > { > pCurrent = new CExceptionsAttribute(m_pClassFile); >*************** >*** 2087,2092 **** >--- 2091,2108 ---- > return NULL; > } > >+ //------------------------------------------------------------------------------ >+ CLocalVariableTypeTableAttribute* >+ CCodeAttribute::GetLocalVariableTypes() >+ { >+ for(CJAttribs::iterator iter = m_Attribs.begin(); iter < m_Attribs.end(); iter++) >+ { >+ if(*(*iter)->GetName() == "LocalVariableTypeTable") >+ return (CLocalVariableTypeTableAttribute*)*iter; >+ } >+ return NULL; >+ } >+ > //============================================================================== > // CExceptionsAttribute implementation > // [1] 4.7.5 >*************** >*** 2275,2281 **** > CLocalVariableTableAttribute::CLocalVariableTableAttribute(CJClassFile* i_pClassFile) > : CAttributeInfo(i_pClassFile) > { >- //TODO: The next line must be changed!!! see TODO #6 in the header file. > u2 u2NameInd = i_pClassFile->GetConstPool()->Add(new CCPUtf8Info("LocalVariableTable")); > m_u2NameInd = u2NameInd; > m_u2TableLength = 0; >--- 2291,2296 ---- >*************** >*** 2335,2340 **** >--- 2350,2462 ---- > //------------------------------------------------------------------------------ > u4 > CLocalVariableTableAttribute::GetLength() const >+ { >+ u4 u4Length = CAttributeInfo::SizeOf() >+ + sizeof(u2) >+ + m_u2TableLength * sizeof(u2) * 5; >+ return u4Length; >+ } >+ >+ //============================================================================== >+ // CLocalVariableTypeTableAttribute implementation >+ // >+ >+ CLocalVariableTypeTable::CLocalVariableTypeTable(const CLocalVariableTypeTable& i_LocalVars) >+ { >+ *this = i_LocalVars; >+ } >+ >+ CLocalVariableTypeTable::~CLocalVariableTypeTable() >+ { >+ for(iterator iter = begin(); iter != end(); iter++) >+ { >+ delete *iter; >+ } >+ } >+ >+ CLocalVariableTypeTable& >+ CLocalVariableTypeTable::operator = (const CLocalVariableTypeTable& i_LocalVars) >+ { >+ for(iterator iter = begin(); iter != end(); iter++) >+ { >+ delete *iter; >+ } >+ if(!i_LocalVars.empty()) >+ { >+ const_iterator iterIn; >+ clear(); >+ for(iterIn = i_LocalVars.begin(); iterIn != i_LocalVars.end(); iterIn++) >+ { >+ push_back(new CLocalVariableTypeInfo(**iterIn)); >+ } >+ } >+ return *this; >+ } >+ >+ //------------------------------------------------------------------------------ >+ CLocalVariableTypeTableAttribute::CLocalVariableTypeTableAttribute(CJClassFile* i_pClassFile) >+ : CAttributeInfo(i_pClassFile) >+ { >+ //TODO: The next line must be changed!!! see TODO #6 in the header file. >+ u2 u2NameInd = i_pClassFile->GetConstPool()->Add(new CCPUtf8Info("LocalVariableTypeTable")); >+ m_u2NameInd = u2NameInd; >+ m_u2TableLength = 0; >+ m_LocalVariableTypeTable.clear(); >+ } >+ >+ //------------------------------------------------------------------------------ >+ CLocalVariableTypeTableAttribute::~CLocalVariableTypeTableAttribute() >+ { >+ } >+ >+ //------------------------------------------------------------------------------ >+ void >+ CLocalVariableTypeTableAttribute::Read(CJStream& i_jstream) >+ { >+ CAttributeInfo::Read(i_jstream); >+ i_jstream >> m_u2TableLength; >+ for(int i = 0; i < m_u2TableLength; i++) >+ { >+ u2 u2StartPC; >+ u2 u2Length; >+ u2 u2NameIndex; >+ u2 u2SignatureIndex; >+ u2 u2Index; >+ i_jstream >> u2StartPC >+ >> u2Length >+ >> u2NameIndex >+ >> u2SignatureIndex >+ >> u2Index; >+ m_LocalVariableTypeTable.push_back(new CLocalVariableTypeInfo(u2StartPC, u2Length, >+ u2NameIndex, u2SignatureIndex, u2Index)); >+ } >+ } >+ >+ //------------------------------------------------------------------------------ >+ void >+ CLocalVariableTypeTableAttribute::Write(CJStream& i_jstream) const >+ { >+ CAttributeInfo::Write(i_jstream); >+ i_jstream << m_u2TableLength; >+ for(int i = 0; i < m_u2TableLength; i++) >+ { >+ i_jstream << m_LocalVariableTypeTable[i]->GetStartPC() >+ << m_LocalVariableTypeTable[i]->GetLength() >+ << m_LocalVariableTypeTable[i]->GetNameIndex() >+ << m_LocalVariableTypeTable[i]->GetSignatureIndex() >+ << m_LocalVariableTypeTable[i]->GetIndex(); >+ } >+ } >+ //------------------------------------------------------------------------------ >+ u4 >+ CLocalVariableTypeTableAttribute::GetSize() const >+ { >+ return GetLength(); >+ } >+ >+ //------------------------------------------------------------------------------ >+ u4 >+ CLocalVariableTypeTableAttribute::GetLength() const > { > u4 u4Length = CAttributeInfo::SizeOf() > + sizeof(u2) >*** BCI\JClass\JClassFile.h@@\main\baltic\0 Tue Dec 13 15:02:32 2005 >--- BCI\JClass\JClassFile.h Wed Dec 14 13:43:48 2005 >*************** >*** 89,94 **** >--- 89,95 ---- > class CExceptionsAttribute; > class CLineNumberTableAttribute; > class CLocalVariableTableAttribute; >+ class CLocalVariableTypeTableAttribute; > > //------------------------------------------------------------------------------ > // Container classes >*************** >*** 684,689 **** >--- 685,691 ---- > > CLineNumberTableAttribute* GetLineNumbers(); > CLocalVariableTableAttribute* GetLocalVariables(); >+ CLocalVariableTypeTableAttribute* GetLocalVariableTypes(); > > protected: > u2 m_u2MaxStack; >*************** >*** 761,767 **** > }; > > //------------------------------------------------------------------------------ >! // LocalVariableTable Attribute > // > class CLocalVariableInfo > { >--- 763,769 ---- > }; > > //------------------------------------------------------------------------------ >! // Local Variable Information > // > class CLocalVariableInfo > { >*************** >*** 798,803 **** >--- 800,807 ---- > u2 m_u2Index; > }; > >+ //------------------------------------------------------------------------------ >+ // Local Variable Table > class CLocalVariableTable : public vector<CLocalVariableInfo*> > { > public: >*************** >*** 809,814 **** >--- 813,821 ---- > > }; > >+ //------------------------------------------------------------------------------ >+ // Local Variable Table Attribute >+ // > class CLocalVariableTableAttribute : public CAttributeInfo > { > public: >*************** >*** 830,835 **** >--- 837,916 ---- > CLocalVariableTable m_LocalVariableTable; > }; > >+ //------------------------------------------------------------------------------ >+ // Local Variable Type Information /New in Java 5/ >+ // >+ class CLocalVariableTypeInfo >+ { >+ public: >+ CLocalVariableTypeInfo(u2 i_u2StartPC = 0, u2 i_u2Length = 0, u2 i_u2NameIndex = 0, >+ u2 i_u2SignatureIndex = 0, u2 i_u2Index = 0) >+ { >+ m_u2StartPC = i_u2StartPC; >+ m_u2Length = i_u2Length; >+ m_u2NameIndex = i_u2NameIndex; >+ m_u2SignatureIndex = i_u2SignatureIndex; >+ m_u2Index = i_u2Index; >+ } >+ >+ CLocalVariableTypeInfo(const CLocalVariableInfo& i_Info) >+ { >+ *this = i_Info; >+ } >+ >+ u2 GetStartPC(){return m_u2StartPC;} >+ u2 GetLength(){return m_u2Length;} >+ u2 GetNameIndex(){return m_u2NameIndex;} >+ u2 GetSignatureIndex(){return m_u2SignatureIndex;} >+ u2 GetIndex(){return m_u2Index;} >+ >+ void SetStartPC(u2 i_u2StartPC){m_u2StartPC = i_u2StartPC;} >+ void SetLength(u2 i_u2Length){m_u2Length = i_u2Length;} >+ >+ private: >+ u2 m_u2StartPC; >+ u2 m_u2Length; >+ u2 m_u2NameIndex; >+ u2 m_u2SignatureIndex; >+ u2 m_u2Index; >+ }; >+ >+ //------------------------------------------------------------------------------ >+ // Local Variable Type Table /New in Java 5/ >+ class CLocalVariableTypeTable : public vector<CLocalVariableTypeInfo*> >+ { >+ public: >+ CLocalVariableTypeTable(){clear();} >+ CLocalVariableTypeTable(const CLocalVariableTypeTable& i_LocalVars); >+ ~CLocalVariableTypeTable(); >+ CLocalVariableTypeTable& operator = (const CLocalVariableTypeTable& i_LocalVars); >+ private: >+ >+ }; >+ >+ //------------------------------------------------------------------------------ >+ // Local Variable Type Table (LVTT) /New in Java 5/ >+ // >+ class CLocalVariableTypeTableAttribute : public CAttributeInfo >+ { >+ public: >+ CLocalVariableTypeTableAttribute(CJClassFile* i_pClassFile); >+ CLocalVariableTypeTableAttribute(const CLocalVariableTableAttribute& i_Locals); >+ ~CLocalVariableTypeTableAttribute(); >+ virtual void Read(CJStream& i_jstream); >+ virtual void Write(CJStream& i_jstream) const; >+ virtual u4 GetSize() const; >+ virtual u4 GetLength() const; >+ >+ u2 GetTableLength() {return m_u2TableLength;} >+ CLocalVariableTypeTable& GetLocalVariableTypeTable(){return m_LocalVariableTypeTable;} >+ >+ CLocalVariableTypeTableAttribute& operator = (const CLocalVariableTypeTableAttribute& i_Locals); >+ >+ private: >+ u2 m_u2TableLength; >+ CLocalVariableTypeTable m_LocalVariableTypeTable; >+ }; > > //------------------------------------------------------------------------------ > // Interface information >*** BCI\BCIEng\BCIEngJ\ModuleJ.cpp@@\main\baltic\0 Tue Dec 13 15:02:22 2005 >--- BCI\BCIEng\BCIEngJ\ModuleJ.cpp Wed Dec 14 13:43:44 2005 >*************** >*** 275,280 **** >--- 275,281 ---- > CMethod::Emit(); > if(NULL == m_pCodeAttr) > return; >+ size_t sizeOrig = GetBody()->GetCodeSize(); // Original code size > // Update the line number information -------------------------------------- > CLineNumberTableAttribute* plinenums = m_pCodeAttr->GetLineNumbers(); > if(NULL != plinenums) >*************** >*** 294,312 **** > } > // Update exceptions and local variable mapping ---------------------------- > // ToDo: Exception tables entries may be hashed to accelerate the process > CExTable& ExTable = m_pCodeAttr->GetExTable(); > CExTable ExTableSav = ExTable; // Save the original exception table > CExTable::iterator iterEx, iterExSav; // Exception table iterators > CLocalVariableTableAttribute* pLclAttr = m_pCodeAttr->GetLocalVariables(); >! CLocalVariableTable& LclTable = pLclAttr->GetLocalVariableTable(); > CLocalVariableTable LclTableSav; > CInsBlocks::iterator iterBlocks; > IP_t ip = 0; > >! if(NULL != pLclAttr) > { >! LclTableSav = LclTable; > } > for(iterBlocks = m_Blocks.begin(); iterBlocks < m_Blocks.end(); iterBlocks++) > { > CInstructions* pins = (*iterBlocks)->GetInstructions(); >--- 295,331 ---- > } > // Update exceptions and local variable mapping ---------------------------- > // ToDo: Exception tables entries may be hashed to accelerate the process >+ >+ // Exceptions > CExTable& ExTable = m_pCodeAttr->GetExTable(); > CExTable ExTableSav = ExTable; // Save the original exception table > CExTable::iterator iterEx, iterExSav; // Exception table iterators >+ >+ // Local Variable >+ CLocalVariableTable lvtNull; >+ CLocalVariableTable::iterator itrLcl, itrLclSav; // LVT Iterator > CLocalVariableTableAttribute* pLclAttr = m_pCodeAttr->GetLocalVariables(); >! CLocalVariableTable& LclTable = pLclAttr?pLclAttr->GetLocalVariableTable():lvtNull; > CLocalVariableTable LclTableSav; >+ >+ // Local Variable Types /New in Java 5/ >+ CLocalVariableTypeTable lvttNull; >+ CLocalVariableTypeTable::iterator itrLclType, itrLclTypeSav; // LVTT Iterator >+ CLocalVariableTypeTableAttribute* pLclTypeAttr = m_pCodeAttr->GetLocalVariableTypes(); >+ CLocalVariableTypeTable& LclTypeTable = pLclTypeAttr?pLclTypeAttr->GetLocalVariableTypeTable():lvttNull; >+ CLocalVariableTypeTable LclTypeTableSav; >+ > CInsBlocks::iterator iterBlocks; > IP_t ip = 0; > >! if(pLclAttr) > { >! LclTableSav = LclTable; // Save the original LVT > } >+ if(pLclTypeAttr) >+ { >+ LclTypeTableSav = LclTypeTable; // Save the original LVTT >+ } > for(iterBlocks = m_Blocks.begin(); iterBlocks < m_Blocks.end(); iterBlocks++) > { > CInstructions* pins = (*iterBlocks)->GetInstructions(); >*************** >*** 345,351 **** > // Scan the local var table > if(NULL != pLclAttr) > { >- CLocalVariableTable::iterator itrLcl, itrLclSav; > itrLclSav = LclTableSav.begin(); > for(itrLcl = LclTable.begin(); itrLcl != LclTable.end(); itrLcl++, itrLclSav++) > { >--- 364,369 ---- >*************** >*** 359,364 **** >--- 377,399 ---- > } > } > } >+ // Scan for the local variable type table >+ if(NULL != pLclTypeAttr) >+ { >+ itrLclTypeSav = LclTypeTableSav.begin(); >+ for(itrLclType = LclTypeTable.begin(); itrLclType != LclTypeTable.end(); itrLclType++, itrLclTypeSav++) >+ { >+ if(ipOrig == (*itrLclTypeSav)->GetStartPC()) >+ { // Original start ip found >+ (*itrLclType)->SetStartPC(ip); >+ } >+ if(ipOrig == (*itrLclTypeSav)->GetStartPC() + (*itrLclTypeSav)->GetLength()) >+ { // Original end ip found >+ (*itrLclType)->SetLength(ip - (*itrLclType)->GetStartPC()); >+ } >+ } >+ } >+ > // Advance ip > ip += (*iterIns)->GetSize(ip); > if(ip >= 0x0000FFFF) >*************** >*** 369,376 **** >--- 404,436 ---- > throw CModuleException(CModuleException::X_REASON_CODE_OVERRUN, strProcName.c_str()); > } > } >+ > } > >+ // Adjust local variable regions pointing beyond the last instruction address >+ size_t sizeNew = ip; >+ if(NULL != pLclAttr) >+ { >+ itrLclSav = LclTableSav.begin(); >+ for(itrLcl = LclTable.begin(); itrLcl != LclTable.end(); itrLcl++, itrLclSav++) >+ { >+ if(sizeOrig == (*itrLclSav)->GetStartPC() + (*itrLclSav)->GetLength()) >+ { >+ (*itrLcl)->SetLength(sizeNew - (*itrLcl)->GetStartPC()); >+ } >+ } >+ } >+ if(NULL != pLclTypeAttr) >+ { >+ itrLclTypeSav = LclTypeTableSav.begin(); >+ for(itrLclType = LclTypeTable.begin(); itrLclType != LclTypeTable.end(); itrLclType++, itrLclTypeSav++) >+ { >+ if(sizeOrig == (*itrLclTypeSav)->GetStartPC() + (*itrLclTypeSav)->GetLength()) >+ { >+ (*itrLclType)->SetLength(sizeNew - (*itrLclType)->GetStartPC()); >+ } >+ } >+ } > // Replace the method body > m_pCodeAttr->SetCode(m_pBody->GetCodeSize(), m_pBody->GiveAvayCode()); > >*** BCI\BCIEng\BCIEngJ\ModuleJ.h@@\main\baltic\0 Tue Dec 13 15:02:26 2005 >--- BCI\BCIEng\BCIEngJ\ModuleJ.h Wed Dec 14 13:43:46 2005 >*************** >*** 90,96 **** > > CCodeAttribute* GetCodeAttribute() {return m_pCodeAttr;} > CSTR GetSignature() const {return m_strSignature.c_str();} >! bool IsAbstract() { return m_u2AccessFlags & ACC_ABSTRACT; }; > > virtual void Parse(); > virtual void Emit(); >--- 90,96 ---- > > CCodeAttribute* GetCodeAttribute() {return m_pCodeAttr;} > CSTR GetSignature() const {return m_strSignature.c_str();} >! bool IsAbstract() { return m_u2AccessFlags & ACC_ABSTRACT != 0; }; > > virtual void Parse(); > virtual void Emit();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 123787
: 32993