VirtualBox

Changes between Initial Version and Version 1 of Ticket #18513, comment 1


Ignore:
Timestamp:
Mar 21, 2019 10:10:26 PM (6 years ago)
Author:
cleanner

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #18513, comment 1

    initial v1  
    1 When I set the VM with a speical name called "'''abc.def'''", it leads to a heap failure after I start the video recording.
    2 
    3 It's because it finally free a string which can not be released by '''RTStrFree()''', which will lead to a heap failure.
    4 
    5 This error still appears in VirtualBox '''5.2.26'''.
    6 
    7 I found that the error comes from "'''src\VBox\Main\src-client\VideoRec.cpp'''", line '''950'''.
    8 
    9 -----------------------------------------------------------------------------------------------
    10 944:    char *pszAbsPath = RTPathAbsDup(com::Utf8Str(pCfg->File.strName).c_str());[[BR]]
    11 
    12 945:    AssertPtrReturn(pszAbsPath, VERR_NO_MEMORY);[[BR]]
    13 
    14 947:    RTPathStripSuffix(pszAbsPath);[[BR]]
    15 
    16 948:    AssertPtrReturn(pszAbsPath, VERR_INVALID_PARAMETER);[[BR]]
    17 
    18 950:    char *pszSuff    = '''RTPathSuffix(pszAbsPath)''';    /*  it should be "char *pszSuff    = '''NULL'''"; */[[BR]]
    19 
    20 951:    if (!pszSuff)[[BR]]
    21 
    22 952:        pszSuff = '''RTStrDup'''(".webm");[[BR]]
    23 
    24 
    25 ......
    26 
    27 991:    '''RTStrFree'''(pszSuff);[[BR]]
    28 
    29 
    30 -----------------------------------------------------------------------------------------------
    31 
    32 Let me try to explain why the error happen if the VM is just called like "'''abc.def'''" or "'''xxx.xxx'''":
    33 
    34 Here we suggest the video recording path is "'''C:\VirtualBox VMs\abc.def\abc.def.webm'''"(it's auto generated by VirtualBox GUI)
    35 
    36 When the applicatioin comes to line '''950''':
    37 
    38 '''pszAbsPath:C:\abc.def'''
    39 
    40 After line '''950''':
    41 
    42 '''pszSuff:.def'''
    43 
    44 Yeah!!!Here we have caught the bug.Got it?
    45 
    46 So when the applicatioin comes to line '''951''':
    47 
    48 the line '''952''' will not excute because the string pointer '''pszSuff(".def")''' is not null, which pointering a string comes from '''RTPathSuffix()''' that returning strings which cannot be released by '''RTStrFree()'''.
    49 
    50 So when the applicatioin comes to line '''991''', as we all know, it will definitely leads to a heap failure.
    51 
    52 A solution is to modify the  line '''950''' as I do above, such as "char *pszSuff    = '''NULL'''". After that, the line '''952''' will execute and the string pointerd by '''pszSuff''' will comes from a string that can be released by '''RTStrFree()''' which return from '''RTStrDup()'''.
    53 
    54 ---------------------------------------------------------------------------
    55 
    56 Finally, I am just a nameless cleanner from china, thanks for updating the new version for the Shanghai/Zhaoxin CPU, thhough which are not developed but just copied by chinese companies.
    57 I hopes that in the fure, several Chinese companies will build a excellent PC/Server field's CPU which are wholly developped by Chinese engineers, even better than CPUs made by Intel/AMD.
     1See Above

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy