Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USE_AFTER_FREE in TextRenderer::textLayoutForLineForPlaceholder(int) #100

Open
vadi2 opened this issue Jun 2, 2020 · 2 comments
Open

USE_AFTER_FREE in TextRenderer::textLayoutForLineForPlaceholder(int) #100

vadi2 opened this issue Jun 2, 2020 · 2 comments

Comments

@vadi2
Copy link
Contributor

vadi2 commented Jun 2, 2020

Coverity is pointing out the following with the new placeholder code:

New defect(s) Reported-by: Coverity Scan
Showing 2 of 2 defect(s)


** CID 1495409:  Memory - illegal accesses  (USE_AFTER_FREE)
/home/travis/build/Mudlet/Mudlet/3rdparty/edbee-lib/edbee-lib/edbee/views/textrenderer.cpp: 300 in edbee::TextRenderer::textLayoutForLineForPlaceholder(int)()


________________________________________________________________________________________________________
*** CID 1495409:  Memory - illegal accesses  (USE_AFTER_FREE)
/home/travis/build/Mudlet/Mudlet/3rdparty/edbee-lib/edbee-lib/edbee/views/textrenderer.cpp: 300 in edbee::TextRenderer::textLayoutForLineForPlaceholder(int)()
294     
295             // add to the cache
296             cachedTextLayoutList_.insert( line, textLayout );
297     //qlog_info() << "Cache Line: " << line;
298     
299         }
>>>     CID 1495409:  Memory - illegal accesses  (USE_AFTER_FREE)
>>>     Using freed pointer "textLayout".
300         return textLayout;
301     }
302     
303     QTextLayout *TextRenderer::textLayoutForLineNormal(int line)
304     {
305         Q_ASSERT( line >= 0 );

** CID 1495408:  Memory - illegal accesses  (USE_AFTER_FREE)
/home/travis/build/Mudlet/Mudlet/3rdparty/edbee-lib/edbee-lib/edbee/views/textrenderer.cpp: 366 in edbee::TextRenderer::textLayoutForLineNormal(int)()


________________________________________________________________________________________________________
*** CID 1495408:  Memory - illegal accesses  (USE_AFTER_FREE)
/home/travis/build/Mudlet/Mudlet/3rdparty/edbee-lib/edbee-lib/edbee/views/textrenderer.cpp: 366 in edbee::TextRenderer::textLayoutForLineNormal(int)()
360             // add to the cache
361             cachedTextLayoutList_.insert( line, textLayout );
362     
363     //qlog_info() << "Cache Line: " << line;
364     
365         }
>>>     CID 1495408:  Memory - illegal accesses  (USE_AFTER_FREE)
>>>     Using freed pointer "textLayout".
366         return textLayout;
367     }
368     
369     
370     /// This method starts rendering
371     void TextRenderer::renderBegin( const QRect& rect )
@gamecreature
Copy link
Member

This issue also happens in the function 'textLayoutForLineNormal' ...

Did you have this issue also before the placeholders?
Because the order of malloc/dealllocs isn't changed by this.

@vadi2
Copy link
Contributor Author

vadi2 commented Jun 2, 2020

Could have been there before - Coverity might have picked this up just because this code was changed. It does some weird caching.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants