- Timestamp:
- Aug 10, 2020 8:18:04 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/ldr/ldrMachO.cpp
r85339 r85678 1552 1552 cSegmentsToAdjust--; 1553 1553 pThis->aSegments[cSegmentsToAdjust].SegInfo.RVA = NIL_RTLDRADDR; 1554 pThis->aSegments[cSegmentsToAdjust].SegInfo.cbMapped = 0;1554 pThis->aSegments[cSegmentsToAdjust].SegInfo.cbMapped = NIL_RTLDRADDR; 1555 1555 continue; 1556 1556 } … … 1564 1564 { 1565 1565 cSegmentsToAdjust--; 1566 pThis->aSegments[cSegmentsToAdjust].SegInfo.RVA = NIL_RTLDRADDR;1567 pThis->aSegments[cSegmentsToAdjust].SegInfo.cbMapped = 0;1566 pThis->aSegments[cSegmentsToAdjust].SegInfo.RVA = NIL_RTLDRADDR; 1567 pThis->aSegments[cSegmentsToAdjust].SegInfo.cbMapped = NIL_RTLDRADDR; 1568 1568 continue; 1569 1569 } … … 4459 4459 uint32_t const cSegments = pThis->cSegments; 4460 4460 for (uint32_t iSeg = 0; iSeg < cSegments; iSeg++) 4461 { 4462 RTLDRADDR offSeg = LinkAddress - pThis->aSegments[iSeg].SegInfo.LinkAddress; 4463 if ( offSeg < pThis->aSegments[iSeg].SegInfo.cbMapped 4464 || offSeg < pThis->aSegments[iSeg].SegInfo.cb) 4465 { 4466 *piSeg = iSeg; 4467 *poffSeg = offSeg; 4468 return VINF_SUCCESS; 4469 } 4470 } 4461 if (pThis->aSegments[iSeg].SegInfo.RVA != NIL_RTLDRADDR) 4462 { 4463 Assert(pThis->aSegments[iSeg].SegInfo.cbMapped != NIL_RTLDRADDR); 4464 RTLDRADDR offSeg = LinkAddress - pThis->aSegments[iSeg].SegInfo.LinkAddress; 4465 if ( offSeg < pThis->aSegments[iSeg].SegInfo.cbMapped 4466 || offSeg < pThis->aSegments[iSeg].SegInfo.cb) 4467 { 4468 *piSeg = iSeg; 4469 *poffSeg = offSeg; 4470 return VINF_SUCCESS; 4471 } 4472 } 4471 4473 4472 4474 return VERR_LDR_INVALID_LINK_ADDRESS; … … 4482 4484 uint32_t const cSegments = pThis->cSegments; 4483 4485 for (uint32_t iSeg = 0; iSeg < cSegments; iSeg++) 4484 { 4485 RTLDRADDR offSeg = LinkAddress - pThis->aSegments[iSeg].SegInfo.LinkAddress; 4486 if ( offSeg < pThis->aSegments[iSeg].SegInfo.cbMapped 4487 || offSeg < pThis->aSegments[iSeg].SegInfo.cb) 4488 { 4489 *pRva = pThis->aSegments[iSeg].SegInfo.RVA + offSeg; 4490 return VINF_SUCCESS; 4491 } 4492 } 4486 if (pThis->aSegments[iSeg].SegInfo.RVA != NIL_RTLDRADDR) 4487 { 4488 Assert(pThis->aSegments[iSeg].SegInfo.cbMapped != NIL_RTLDRADDR); 4489 RTLDRADDR offSeg = LinkAddress - pThis->aSegments[iSeg].SegInfo.LinkAddress; 4490 if ( offSeg < pThis->aSegments[iSeg].SegInfo.cbMapped 4491 || offSeg < pThis->aSegments[iSeg].SegInfo.cb) 4492 { 4493 *pRva = pThis->aSegments[iSeg].SegInfo.RVA + offSeg; 4494 return VINF_SUCCESS; 4495 } 4496 } 4493 4497 4494 4498 return VERR_LDR_INVALID_RVA; … … 4506 4510 return VERR_LDR_INVALID_SEG_OFFSET; 4507 4511 RTLDRMODMACHOSEG const *pSegment = &pThis->aSegments[iSeg]; 4512 4513 if (pSegment->SegInfo.RVA == NIL_RTLDRADDR) 4514 return VERR_LDR_INVALID_SEG_OFFSET; 4508 4515 4509 4516 if ( offSeg > pSegment->SegInfo.cbMapped … … 4526 4533 uint32_t const cSegments = pThis->cSegments; 4527 4534 for (uint32_t iSeg = 0; iSeg < cSegments; iSeg++) 4528 { 4529 RTLDRADDR offSeg = Rva - pThis->aSegments[iSeg].SegInfo.RVA; 4530 if ( offSeg < pThis->aSegments[iSeg].SegInfo.cbMapped 4531 || offSeg < pThis->aSegments[iSeg].SegInfo.cb) 4532 { 4533 *piSeg = iSeg; 4534 *poffSeg = offSeg; 4535 return VINF_SUCCESS; 4536 } 4537 } 4535 if (pThis->aSegments[iSeg].SegInfo.RVA != NIL_RTLDRADDR) 4536 { 4537 Assert(pThis->aSegments[iSeg].SegInfo.cbMapped != NIL_RTLDRADDR); 4538 RTLDRADDR offSeg = Rva - pThis->aSegments[iSeg].SegInfo.RVA; 4539 if ( offSeg < pThis->aSegments[iSeg].SegInfo.cbMapped 4540 || offSeg < pThis->aSegments[iSeg].SegInfo.cb) 4541 { 4542 *piSeg = iSeg; 4543 *poffSeg = offSeg; 4544 return VINF_SUCCESS; 4545 } 4546 } 4538 4547 4539 4548 return VERR_LDR_INVALID_RVA;
Note:
See TracChangeset
for help on using the changeset viewer.