Changeset 1836 for trunk/dll/collect.c


Ignore:
Timestamp:
Jul 15, 2015, 2:48:14 AM (10 years ago)
Author:
Gregg Young
Message:

Fix trap in collector if a pci-pszFileName = NullStr and fix heap corruption problem and its related traps. This code reverts John double free fix. Ticket [551][555]

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/collect.c

    r1803 r1836  
    8989  02 May 15 GKY Changes to allow a JAVA executable object to be created using "Real object"
    9090                menu item on a jar file.
     91  14 Jun 15 GKY Changes to prevent trap in Filter
    9192
    9293***********************************************************************/
     
    748749            }
    749750            else {
    750               // Update OK
    751               if (Filter((PMINIRECORDCORE) pciUpd, (PVOID) & dcd->mask)) {
     751              // Update OK
     752              DosRequestMutexSem(hmtxFiltering, SEM_INDEFINITE_WAIT);
     753              if (dcd && Filter((PMINIRECORDCORE) pciUpd, (PVOID) & dcd->mask)) {
    752754                pciUpd->rc.flRecordAttr &= ~CRA_FILTERED;       // Ensure visible
    753755                // 2011-05-29 SHL fixme to check fail
    754756                WinSendMsg(dcd->hwndCnr, CM_INVALIDATERECORD, MPVOID,
    755757                           MPFROM2SHORT(0, CMA_REPOSITION | CMA_ERASE));
    756               }
     758              }
     759              DosReleaseMutexSem(hmtxFiltering);
    757760            }
    758761            ulMaxFiles--;               // No insert needed
     
    913916                              TRUE)) {
    914917              // Already in container
    915               pci = UpdateCnrRecord(dcd->hwndCnr, fullname, FALSE, dcd);
    916               if (Filter((PMINIRECORDCORE) pci, (PVOID) & dcd->mask)) {
     918              pci = UpdateCnrRecord(dcd->hwndCnr, fullname, FALSE, dcd);
     919              DosRequestMutexSem(hmtxFiltering, SEM_INDEFINITE_WAIT);
     920              if (dcd && Filter((PMINIRECORDCORE) pci, (PVOID) & dcd->mask)) {
    917921                pci->rc.flRecordAttr &= ~CRA_FILTERED;
    918922                WinSendMsg(dcd->hwndCnr, CM_INVALIDATERECORD, MPVOID,
    919923                           MPFROM2SHORT(0, CMA_REPOSITION | CMA_ERASE));
    920               }
     924              }
     925              DosReleaseMutexSem(hmtxFiltering);
    921926            }
    922927            else if (IsFullName(fullname) &&
     
    11681173      DosRequestMutexSem(hmtxFiltering, SEM_INDEFINITE_WAIT);
    11691174      free(dcd);
     1175      dcd = NULL;
    11701176      DosReleaseMutexSem(hmtxFiltering);
    11711177#     ifdef FORTIFY
     
    14251431              p = pci->pszFileName;
    14261432            else {
    1427               if (!pci->pszFileName)
    1428                 Runtime_Error(pszSrcFile, __LINE__, "pci->pszFileName NULL for %p", pci);
    1429               p = strrchr(pci->pszFileName, '\\');
     1433              if (!pci->pszFileName) {
     1434                Runtime_Error(pszSrcFile, __LINE__, "pci->pszFileName NULL for %p", pci);
     1435                return 0;
     1436              }
     1437              p = strrchr(pci->pszFileName, '\\');
    14301438              if (p) {
    14311439                if (*(p + 1))
     
    21282136            // 2013-12-13 SHL Allow nul pszFileName
    21292137            pci = (PCNRITEM) CurrentRecord(hwnd);
    2130             if (pci && pci->pszFileName && ~pci->attrFile & FILE_DIRECTORY) {
     2138            if (pci && pci->pszFileName != NullStr && ~pci->attrFile & FILE_DIRECTORY) {
    21312139              p = strrchr(pci->pszFileName, '\\');
    21322140              if (p) {
     
    28152823      case CN_ENDEDIT:
    28162824        {
    2817           MRESULT mre;
    2818 
    2819           mre = CnrDirectEdit(hwnd, msg, mp1, mp2);
     2825          MRESULT mre;
     2826
     2827          mre = CnrDirectEdit(hwnd, msg, mp1, mp2);
    28202828          if (mre != (MRESULT) - 1)
    28212829            return mre;
Note: See TracChangeset for help on using the changeset viewer.