Hello,
My name is Stefan Mirea, I study Automatic Control and Computers at
Politehnica University of Bucharest and I'd like to contribute to
BRL-CAD as a software developer. I read some of the documentation and
Wiki articles and I also downloaded and built BRL-CAD.
I think that fixing a bug would be a good start, so I chose the second
bug in the BUGS file (the first one is about Windows and I am a Linux
user). The problem is that ray tracing fails when you make a shader
and give it some dimensions so that the product width * height is
greater than the actual area of the image (however, is still works
when the difference is very small).
I looked into the source code and I found that the cp pointer in
txt_render() is used to access memory from tp->tx_mp->buf or
tp->tx_binunifp->u.uint8 to get the pixel colors, but it is
dereferenced without verifying whether the offset exceeds the buffer
size. txt_load_datasource() in sh_text.c checks if the real size of
the image file matches the one corresponding to the given dimensions
(and it does a good job), but will only produce a warning.
I think that the best fix would be rendering a specific color (such as
white) in the regions of the surface that would require "out of image"
access. If the color of just one pixel is needed (when
(dx == 0 && dy == 0) - line 304 in sh_text.c), then txt_render()
should simply set r, g, and b to that default color. Otherwise, when
the function would normally compute the weighted average of the cells,
I would only check if the furthest needed cell in the buffer exceeds
its size (without looping through the neighboring pixels).
I need your feedback concerning my suggestions, as this would be my
first contribution to an open source project.
Regards,
Stefan
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Developer mailing list
brlcad-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-devel