Page MenuHomePhabricator

ector_software_rasterizer: use dynamic array by span size.
ClosedPublic

Authored by jsuya on Nov 27 2019, 2:00 AM.

Details

Summary

When use with intersect mask, if span_count over span array size, composition is to be wrong.
So, In this case, we use dynamic array by span_count.

Test Plan

N/A

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.
jsuya created this revision.Nov 27 2019, 2:00 AM
jsuya requested review of this revision.Nov 27 2019, 2:00 AM
vtorri added a subscriber: vtorri.Nov 27 2019, 4:56 AM
vtorri added inline comments.
src/lib/ector/software/ector_software_rasterizer.c
539

why not using ternary operator ?

587

same as above

jsuya updated this revision to Diff 27168.Nov 27 2019, 6:02 PM

Update patch. thanks @vtorri

Hermet requested changes to this revision.Nov 27 2019, 9:53 PM

Please check a comment.

src/lib/ector/software/ector_software_rasterizer.c
536

stack overflow could be occurred if span_count is huge,
Please OOM handling with ERR();

This revision now requires changes to proceed.Nov 27 2019, 9:53 PM
jsuya updated this revision to Diff 27177.Nov 27 2019, 11:15 PM

change alloca to malloc
and add null check

jsuya marked an inline comment as done.Nov 27 2019, 11:16 PM
Hermet requested changes to this revision.Nov 28 2019, 5:09 PM
Hermet added inline comments.
src/lib/ector/software/ector_software_rasterizer.c
536

No,, I think alloca() is affordable here. you just missed exception case.

This revision now requires changes to proceed.Nov 28 2019, 5:09 PM
jsuya marked an inline comment as done.Dec 3 2019, 4:50 PM
jsuya added inline comments.
src/lib/ector/software/ector_software_rasterizer.c
536

@Hermet
As far as I know that alloca cannot check exceptions when OOM occurs.
Please see man pages (http://man7.org/linux/man-pages/man3/alloca.3.html#RETURN_VALUE)

In this case, the memory allocation may be higher than expected compared to the other alloac cases. So I used malloc-free.

jsuya updated this revision to Diff 27325.Dec 4 2019, 10:08 PM
jsuya marked an inline comment as done.

update patch

Hermet accepted this revision.Dec 5 2019, 5:37 PM
This revision is now accepted and ready to land.Dec 5 2019, 5:37 PM
This revision was automatically updated to reflect the committed changes.