Revision: 77331
http://sourceforge.net/p/brlcad/code/77331
Author: brlcad
Date: 2020-10-05 14:20:07 +0000 (Mon, 05 Oct 2020)
Log Message:
-----------
don't look for a hard-coded 'shaders.so' library. quite the security
vulnerability. also, more consistently check for the library with and without
the lib prefix (not great, but ugh)
Modified Paths:
--------------
brlcad/trunk/src/liboptical/material.c
brlcad/trunk/src/liboptical/sh_xxx.c
Modified: brlcad/trunk/src/liboptical/material.c
===================================================================
--- brlcad/trunk/src/liboptical/material.c 2020-10-05 14:12:05 UTC (rev
77330)
+++ brlcad/trunk/src/liboptical/material.c 2020-10-05 14:20:07 UTC (rev
77331)
@@ -156,12 +156,19 @@
if ((shader_mfuncs = try_load(libname, material, sh_name)))
goto done;
- /* Look in the current working directory for shaders.so */
- snprintf(libname, sizeof(libname), "%s/shaders.so", cwd);
+ /* Look in the current working directory for lib{sh_name}.so */
+ snprintf(libname, sizeof(libname), "%s/lib%s.so", cwd, sh_name);
if ((shader_mfuncs = try_load(libname, material, sh_name)))
goto done;
/* Look in the location indicated by $LD_LIBRARY_PATH for
+ * {sh_name}.so
+ */
+ snprintf(libname, sizeof(libname), "%s.so", sh_name);
+ if ((shader_mfuncs = try_load(libname, material, sh_name)))
+ goto done;
+
+ /* Look in the location indicated by $LD_LIBRARY_PATH for
* lib{sh_name}.so
*/
snprintf(libname, sizeof(libname), "lib%s.so", sh_name);
@@ -169,6 +176,12 @@
goto done;
/* Look in BRL-CAD install dir under lib dir for lib{sh_name}.so */
+ snprintf(libpath, sizeof(libpath), "/lib/%s.so", sh_name);
+ bu_strlcpy(libname, bu_brlcad_root(libpath, 1), sizeof(libname));
+ if ((shader_mfuncs = try_load(libname, material, sh_name)))
+ goto done;
+
+ /* Look in BRL-CAD install dir under lib dir for lib{sh_name}.so */
snprintf(libpath, sizeof(libpath), "/lib/lib%s.so", sh_name);
bu_strlcpy(libname, bu_brlcad_root(libpath, 1), sizeof(libname));
if ((shader_mfuncs = try_load(libname, material, sh_name)))
Modified: brlcad/trunk/src/liboptical/sh_xxx.c
===================================================================
--- brlcad/trunk/src/liboptical/sh_xxx.c 2020-10-05 14:12:05 UTC (rev
77330)
+++ brlcad/trunk/src/liboptical/sh_xxx.c 2020-10-05 14:20:07 UTC (rev
77331)
@@ -35,9 +35,7 @@
* edit the xxx_render function to do the actual rendering
*
* If you are building a dynamically loaded shader, compile this into a
- * shared library called "shadername.so". If you have a number of shaders
- * for you are adding, you can create a single library called "shaders.so"
- * which contains all of your DSO shaders.
+ * shared library called "shadername.so" or "libshadername.so".
*
* RT will look in the following locations for DSO shaders:
* ./
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits