VirtualBox

Changeset 73722 in vbox for trunk/src


Ignore:
Timestamp:
Aug 16, 2018 6:09:40 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
124401
Message:

Devices/Serial: Crash fix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Serial/DrvCharNew.cpp

    r73713 r73722  
    250250                }
    251251
    252                 size_t cbProcessed = pThis->cbTxUsed;
    253                 rc = pThis->pDrvStream->pfnWrite(pThis->pDrvStream, &pThis->abTxBuf[0], &cbProcessed);
    254                 if (RT_SUCCESS(rc))
     252                if (pThis->cbTxUsed)
    255253                {
    256                     pThis->cbTxUsed -= cbProcessed;
    257                     if (pThis->cbTxUsed)
     254                    size_t cbProcessed = pThis->cbTxUsed;
     255                    rc = pThis->pDrvStream->pfnWrite(pThis->pDrvStream, &pThis->abTxBuf[0], &cbProcessed);
     256                    if (RT_SUCCESS(rc))
    258257                    {
    259                         /* Move the data in the TX buffer to the front to fill the end again. */
    260                         memmove(&pThis->abTxBuf[0], &pThis->abTxBuf[cbProcessed], pThis->cbTxUsed);
     258                        pThis->cbTxUsed -= cbProcessed;
     259                        if (pThis->cbTxUsed)
     260                        {
     261                            /* Move the data in the TX buffer to the front to fill the end again. */
     262                            memmove(&pThis->abTxBuf[0], &pThis->abTxBuf[cbProcessed], pThis->cbTxUsed);
     263                        }
     264                        else
     265                            pThis->pDrvSerialPort->pfnDataSentNotify(pThis->pDrvSerialPort);
     266                        STAM_COUNTER_ADD(&pThis->StatBytesWritten, cbProcessed);
    261267                    }
    262                     else
    263                         pThis->pDrvSerialPort->pfnDataSentNotify(pThis->pDrvSerialPort);
    264                     STAM_COUNTER_ADD(&pThis->StatBytesWritten, cbProcessed);
    265                 }
    266                 else if (rc != VERR_TIMEOUT)
    267                 {
    268                     LogRel(("Char#%d: Write failed with %Rrc; skipping\n", pDrvIns->iInstance, rc));
    269                     break;
     268                    else if (rc != VERR_TIMEOUT)
     269                    {
     270                        LogRel(("Char#%d: Write failed with %Rrc; skipping\n", pDrvIns->iInstance, rc));
     271                        break;
     272                    }
    270273                }
    271274            }
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette