equal
deleted
inserted
replaced
171 } |
171 } |
172 } |
172 } |
173 |
173 |
174 // copy export directory (this will now have fixups applied)... |
174 // copy export directory (this will now have fixups applied)... |
175 TInt exportDirSize = iRamInfo.iExportDirCount * sizeof(TLinAddr); |
175 TInt exportDirSize = iRamInfo.iExportDirCount * sizeof(TLinAddr); |
176 if (exportDirSize > 0 || (exportDirSize==0 && (iCodeSeg->iAttr&ECodeSegAttNmdExpData)) ) |
176 if (exportDirSize > 0 || (exportDirSize == 0 && (iCodeSeg->iAttr & ECodeSegAttNmdExpData)) ) |
177 { |
177 { |
178 exportDirSize += sizeof(TLinAddr); |
178 exportDirSize += sizeof(TLinAddr); |
|
179 TLinAddr expDirRunAddr = iRamInfo.iExportDir - sizeof(TLinAddr); |
|
180 if (expDirRunAddr < iRamInfo.iCodeRunAddr || |
|
181 expDirRunAddr + exportDirSize > iRamInfo.iCodeRunAddr + iRamInfo.iCodeSize) |
|
182 {// Invalid export section. |
|
183 return KErrCorrupt; |
|
184 } |
179 TLinAddr* expDir = (TLinAddr*)Kern::Alloc(exportDirSize); |
185 TLinAddr* expDir = (TLinAddr*)Kern::Alloc(exportDirSize); |
180 if (!expDir) |
186 if (!expDir) |
181 return KErrNoMemory; |
187 return KErrNoMemory; |
182 iCopyOfExportDir = expDir; |
188 iCopyOfExportDir = expDir; |
183 UNLOCK_USER_MEMORY(); |
189 UNLOCK_USER_MEMORY(); |
184 memcpy(expDir,(TAny*)(iRamInfo.iExportDir-sizeof(TLinAddr)),exportDirSize); |
190 memcpy(expDir, (TAny*)expDirRunAddr, exportDirSize); |
185 LOCK_USER_MEMORY(); |
191 LOCK_USER_MEMORY(); |
186 } |
192 } |
187 } |
193 } |
188 |
194 |
189 // unmap code from loading process... |
195 // unmap code from loading process... |