Skip to content

Executable crash #186

@user6927

Description

@user6927

The problem is in tidyDocRelease( TidyDocImpl* doc ).The lexer sometimes is required after being released:

tidy5d.exe!prvTidyHTMLVersion(_TidyDocImpl * doc)  Line 189 + 0x6 bytes C
tidy5d.exe!prvTidyRemoveAnchorByNode(_TidyDocImpl * doc, const char * name, _Node * node)  Line 1012 + 0x9 bytes    C
tidy5d.exe!prvTidyFreeAttrs(_TidyDocImpl * doc, _Node * node)  Line 1176 + 0x14 bytes   C
tidy5d.exe!prvTidyFreeNode(_TidyDocImpl * doc, _Node * node)  Line 1244 + 0xd bytes C
tidy5d.exe!prvTidyFreeNode(_TidyDocImpl * doc, _Node * node)  Line 1245 + 0x10 bytes    C
tidy5d.exe!prvTidyFreeNode(_TidyDocImpl * doc, _Node * node)  Line 1245 + 0x10 bytes    C
tidy5d.exe!prvTidyFreeNode(_TidyDocImpl * doc, _Node * node)  Line 1245 + 0x10 bytes    C
tidy5d.exe!prvTidyFreeNode(_TidyDocImpl * doc, _Node * node)  Line 1245 + 0x10 bytes    C
tidy5d.exe!prvTidyFreeNode(_TidyDocImpl * doc, _Node * node)  Line 1245 + 0x10 bytes    C
tidy5d.exe!prvTidyFreeNode(_TidyDocImpl * doc, _Node * node)  Line 1245 + 0x10 bytes    C
tidy5d.exe!tidyDocRelease(_TidyDocImpl * doc)  Line 175 + 0xd bytes C
tidy5d.exe!tidyRelease(const _TidyDoc * tdoc)  Line 137 + 0x9 bytes C
tidy5d.exe!main(int argc, char * * argv)  Line 1374 C
tidy5d.exe!__tmainCRTStartup()  Line 555 + 0x19 bytes   C
tidy5d.exe!mainCRTStartup()  Line 371   C
kernel32.dll!758b338a()     
[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]  
ntdll.dll!77c89f72()    
ntdll.dll!77c89f45()    

The source code fragment:

int TY_(HTMLVersion)(TidyDocImpl* doc)
{
uint i;
uint j = 0;
uint score = 0;
uint vers = doc->lexer->versions;
....

Lazy fix:

void tidyDocRelease( TidyDocImpl* doc )
{
/* doc in/out opened and closed by parse/print routines */
if ( doc )
{
assert( doc->docIn == NULL );
assert( doc->docOut == NULL );
TY_(ReleaseStreamOut)( doc, doc->errout );
doc->errout = NULL;
TY_(FreePrintBuf)( doc );
// TY_(FreeLexer)( doc );
TY_(FreeNode)(doc, &doc->root);
TidyClearMemory(&doc->root, sizeof(Node));
if (doc->givenDoctype)
TidyDocFree(doc, doc->givenDoctype);
TY_(FreeConfig)( doc );
TY_(FreeAttrTable)( doc );
TY_(FreeTags)( doc );
TY_(FreeLexer)( doc ); // moved
TidyDocFree( doc, doc );
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions