| 51 | | |
| 52 | | Replying to [ticket:18513 cleanner]: |
| 53 | | > When I set the VM with a speical name called "'''abc.def'''", it leads to a heap failure after I start the video recording. |
| 54 | | > |
| 55 | | > It's because it finally free a string which can not be released by '''RTStrFree()''', which will lead to a heap failure. |
| 56 | | > |
| 57 | | > I found that the error comes from "'''src\VBox\Main\src-client\VideoRec.cpp'''", line '''950'''. |
| 58 | | > |
| 59 | | > ----------------------------------------------------------------------------------------------- |
| 60 | | > 944: char *pszAbsPath = RTPathAbsDup(com::Utf8Str(pCfg->File.strName).c_str());[[BR]] |
| 61 | | > |
| 62 | | > 945: AssertPtrReturn(pszAbsPath, VERR_NO_MEMORY);[[BR]] |
| 63 | | > |
| 64 | | > 947: RTPathStripSuffix(pszAbsPath);[[BR]] |
| 65 | | > |
| 66 | | > 948: AssertPtrReturn(pszAbsPath, VERR_INVALID_PARAMETER);[[BR]] |
| 67 | | > |
| 68 | | > 950: char *pszSuff = '''RTPathSuffix(pszAbsPath)'''; /* it should be "char *pszSuff = '''NULL'''"; */[[BR]] |
| 69 | | > |
| 70 | | > 951: if (!pszSuff)[[BR]] |
| 71 | | > |
| 72 | | > 952: pszSuff = '''RTStrDup'''(".webm");[[BR]] |
| 73 | | > |
| 74 | | > |
| 75 | | > ...... |
| 76 | | > |
| 77 | | > 991: '''RTStrFree'''(pszSuff);[[BR]] |
| 78 | | > |
| 79 | | > |
| 80 | | > ----------------------------------------------------------------------------------------------- |
| 81 | | > |
| 82 | | > Let me try to explain why the error happen if the VM is just called like "'''abc.def'''" or "'''xxx.xxx'''": |
| 83 | | > |
| 84 | | > Here we suggest the video recording path is "'''C:\abc.def.webm'''"(it's auto generated by VirtualBox GUI) |
| 85 | | > |
| 86 | | > When the applicatioin comes to line '''950''': |
| 87 | | > |
| 88 | | > '''pszAbsPath:C:\abc.def''' |
| 89 | | > |
| 90 | | > After line '''950''': |
| 91 | | > |
| 92 | | > '''pszSuff:.def''' |
| 93 | | > |
| 94 | | > Yeah!!!We catch the bug.Got it? |
| 95 | | > |
| 96 | | > So when the applicatioin comes to line '''951''': |
| 97 | | > |
| 98 | | > the line '''952''' will not excute because the string '''pszSuff(".def")''' comes from '''RTPathSuffix()''', which returns a string that cannot be release by '''RTStrFree()'''. |
| 99 | | > |
| 100 | | > So when the applicatioin comes to line '''991''', as we all know, it will definitely leads to a heap failure. |
| 101 | | > |
| 102 | | > 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()'''. |
| 103 | | > |
| 104 | | > --------------------------------------------------------------------------- |
| 105 | | > |
| 106 | | > 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. |
| 107 | | > 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. |