Page MenuHomePhabricator

efl_canvas_vg_object: Fix dereference after null check
ClosedPublic

Authored by devilhorns on Mar 14 2019, 10:14 AM.

Details

Summary

Coverity reports that both pname & file variables can be null here,
and that we are potentially passing NULL to strcmp. Check for valid
variables before passing to strcmp

Fixes Coverity CID1399423, CID1399421

@fix

Diff Detail

Repository
rEFL core/efl
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
devilhorns created this revision.Mar 14 2019, 10:14 AM
devilhorns requested review of this revision.Mar 14 2019, 10:14 AM
cedric requested changes to this revision.Mar 14 2019, 3:38 PM
cedric added inline comments.
src/lib/evas/canvas/efl_canvas_vg_object.c
260

This doesn't seems correct, but I am not sure. The idea of the test seems to be an if pname and file are different. Maybe adding a check for size <= 1 ?

This revision now requires changes to proceed.Mar 14 2019, 3:38 PM
devilhorns updated this revision to Diff 20615.Mar 15 2019, 5:55 AM
devilhorns edited the summary of this revision. (Show Details)

rebase

devilhorns updated this revision to Diff 20622.Mar 15 2019, 6:02 AM
devilhorns edited the summary of this revision. (Show Details)

no changes

devilhorns updated this revision to Diff 20638.Mar 15 2019, 9:42 AM
devilhorns edited the summary of this revision. (Show Details)

no changes

devilhorns updated this revision to Diff 20684.Mar 18 2019, 5:15 AM

no changes

@cedric i think that does not matter here, if the size is not the same, then the if clause will be executed anyways, if the file size is the same, then compare the content. I think this works as intended, but i am not too sure, can you verify again ?

devilhorns updated this revision to Diff 20693.Mar 18 2019, 8:44 AM

no changes

bu5hm4n accepted this revision.Mar 20 2019, 9:48 AM

If one, either pname or fileis NULL then the pl / cl is different, and the block is executed. Hence, if the strcmp is executed either both are NULL or both are not NULL. Thus This commit seems fine.

This revision was not accepted when it landed; it landed in state Needs Review.Mar 20 2019, 10:07 AM
Closed by commit rEFL2d7678074eb0: efl_canvas_vg_object: Fix dereference after null check (authored by devilhorns, committed by Marcel Hollerbach <mail@marcel-hollerbach.de>). · Explain Why
This revision was automatically updated to reflect the committed changes.