equal
deleted
inserted
replaced
219 |
219 |
220 // copy export directory (this will now have fixups applied)... |
220 // copy export directory (this will now have fixups applied)... |
221 TInt exportDirSize = iRamInfo.iExportDirCount * sizeof(TLinAddr); |
221 TInt exportDirSize = iRamInfo.iExportDirCount * sizeof(TLinAddr); |
222 if(exportDirSize > 0 || (exportDirSize==0 && (iCodeSeg->iAttr&ECodeSegAttNmdExpData)) ) |
222 if(exportDirSize > 0 || (exportDirSize==0 && (iCodeSeg->iAttr&ECodeSegAttNmdExpData)) ) |
223 { |
223 { |
224 TLinAddr expDirLoad = iRamInfo.iExportDir - iRamInfo.iCodeRunAddr + iRamInfo.iCodeLoadAddr; |
|
225 if (expDirLoad < iRamInfo.iCodeLoadAddr || |
|
226 expDirLoad + exportDirSize > iRamInfo.iCodeLoadAddr + iRamInfo.iCodeSize) |
|
227 {// Invalid export section but the loader should have checked this. |
|
228 return KErrCorrupt; |
|
229 } |
|
230 exportDirSize += sizeof(TLinAddr); |
224 exportDirSize += sizeof(TLinAddr); |
231 TLinAddr* expDir = (TLinAddr*)Kern::Alloc(exportDirSize); |
225 TLinAddr* expDir = (TLinAddr*)Kern::Alloc(exportDirSize); |
232 if(!expDir) |
226 if(!expDir) |
233 return KErrNoMemory; |
227 return KErrNoMemory; |
234 iCopyOfExportDir = expDir; |
228 iCopyOfExportDir = expDir; |
|
229 TLinAddr expDirLoad = iRamInfo.iExportDir-iRamInfo.iCodeRunAddr+iRamInfo.iCodeLoadAddr; |
235 UNLOCK_USER_MEMORY(); |
230 UNLOCK_USER_MEMORY(); |
236 memcpy(expDir,(TAny*)(expDirLoad-sizeof(TLinAddr)),exportDirSize); |
231 memcpy(expDir,(TAny*)(expDirLoad-sizeof(TLinAddr)),exportDirSize); |
237 LOCK_USER_MEMORY(); |
232 LOCK_USER_MEMORY(); |
238 } |
233 } |
239 |
234 |