Marc-André Lureau
7febc0023b
vtest: be reasonable about cmd length
...
Avoid overflow, found thanks to AddressSanitizer & american fuzzy lop.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
02e81fec0e
renderer: unref index buffer when destroying sub context
...
Found thanks to AddressSanitizer.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
e9e19b5b47
renderer: switch to context 0 before destroy sub
...
If the current context is one of the subcontext to be destroyed,
vrend_destroy_sub_context() will fail after the last context is
destroyed.
Found thanks to amaerican fuzzy lop.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
a342dc9149
renderer: fix leak in hashtable on replace
...
Some american fuzzy lop tests managed to replace resources, however the
old values got leaked (I am not sure if this should be allowed)
In all cases, introduce a destroy callback to the hashtable, used when a
value is removed, replaced or the table is cleared. This simplifies a
bit resource management and help avoid potential errors by using simply
refcounts.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
dcc83cca07
renderer: unref resource when destroying hashtable element
...
Resources are reference-counted, if another object holds a reference to
a resource, it should not free it. Change the resource hashtable destroy
callback to unref.
Currently, this doesn't happen, since the resource hashtable is kept
until the renderer is reset. However, in the next commit, the destroy
callback will be used if a resource is replaced in the hashtable, and we
want to keep the original resource. Furthermore, even if replace
shouldn't happen, it avoids confusion and future errors if use only
reference-counting mechanism.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
3ff41ae384
renderer: fix potential leaks in vrend_create_shader
...
Found thanks to llvm scan-build.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
4f9a36367e
renderer: check create_shader() finished
...
Fix found thanks to american fuzzy lop.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
1e67b391cc
renderer: fix sampler views leaks
...
Fix found thanks to AddressSanitizer.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
595038e564
renderer: fix subcontext surface leaks
...
Fix leaks found thanks to AddressSanitizer.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
97ce5ea3f7
renderer: tinitial abs_s1 value is never read
...
Found thanks to llvm scan-build.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
ec24bd2211
decode: fix set_scissor_state bounds
...
Do not accept negative values for num & start.
Fix found thanks to american fuzzy lop.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
78f8994a63
decode: check set_uniform_buffer arguments
...
Fix found thanks to american fuzzy lop.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
3c0a03de89
decode: check set_sampler_views args
...
Fix found thanks to american fuzzy lop.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
9be86b89fb
renderer: check box bounds
...
Fix found thanks to american fuzzy lop.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
901b77d29e
renderer: validate desc
...
Fix found thanks to american fuzzy lop.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
043905990f
renderer: over-allocate shader buffer
...
Since the memcpy() is done over multiple of 4 bytes, over-allocate the
destination buffer to fit multiple of 4 shader length.
Fix found thanks to american fuzzy lop.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
e215bde74e
renderer: check shader continuation fits
...
Fix found thanks to american fuzzy lop.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
bfa6cd741d
renderer: prevent out of bound vps access
...
Fix found thanks to american fuzzy lop.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
18e4808c1d
renderer: avoid out of bound sampler array access
...
Fix found thanks to american fuzzy lop.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
775f5ed62a
renderer: validate shader_type value
...
Fix found thanks to american fuzzy lop.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
ddb49b5931
vtest: ensure name is ending with 0
...
Always nice to have.
Fix found thanks to american fuzzy lop.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
0f01f30fb2
vtest: fix simple potential leaks
...
Found thanks to llvm scan-build.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
1edf354bf8
vtest: fix some leaks on error
...
Found thanks to llvm scan-build.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
1b736c547a
vtest: allow to save/replay tests
...
This is useful to do some quite accurate comparative
benchmarks/profiling, and to run fuzzers, such as american fuzzy lop.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
36492a4012
decode: validate shader type
...
Fix found thanks to american fuzzy lop.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
ad4f0f1941
renderer: reject large LOD values
...
Or we could sit for a very long time in some further loops.
Fix found thanks to american fuzzy lop.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
f58e985a63
renderer: report error on invalid surface
...
Instead of later crashing.
Fix found thanks to american fuzzy lop.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
b079de618e
renderer: validate scissor state index
...
Check the the index is < PIPE_MAX_VIEWPORTS.
Fix found thanks to american fuzzy lop.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
2aa6c5bca9
decode: check we don't reach MAX_VIEWPORTS
...
Fix found thanks to american fuzzy lop.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
e0e423aacd
renderer: avoid crash in vrend_destroy_shader_selector()
...
If we didn't run succesfully vrend_destroy_shader_selector(),
sel->sinfo.so_names might be NULL.
Fix found thanks to american fuzzy lop.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
9033b26976
renderer: validate num_so_outputs
...
Avoid out-of-bound acces of array so_info.output.
Fix found thanks to american fuzzy lop.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
3767dbf18c
renderer: use a uint32_t for shader type
...
That way an value if (type > PIPE_SHADER_GEOMETRY) guard will actually
work for all values.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
6a73ddfccc
renderer: fix some vrend_sub_context leaks
...
Fix leaks found thanks to AddressSanitizer.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
0cb1bd0fff
renderer: do not accept invalid format
...
That would later crash in util_format_description() or others
Fix found thanks to american fuzzy lop.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
2a4d35b8b3
renderer: fix potential leak
...
Found thanks to llvm scan-build.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
8030fdbd92
renderer: fix potential leak
...
Found thanks to llvm scan-build.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
2c6081225b
shader: fix potential leak
...
Found thanks to llvm scan-build.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
602e68705e
vtest: fix vtestname leak
...
Fix leaks found thanks to AddressSanitizer.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
e1eef9a7f9
tests: use checked fixture
...
The checked fixture run in the child test process.
Fix leaks found thanks to AddressSanitizer.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
c54e1a76da
Fix os-time.h removal
...
Commit 5058068
actually removed os/os_misc.h from libgallium_la_SOURCES
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
1795f9ca2c
renderer: fix eventfd check
...
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
51bf76036e
renderer: destroy cond/mutex
...
For completeness (there is no dynamic allocation on Linux).
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
9 years ago
Marc-André Lureau
bc358da307
decode: prevent handle 0 object creation
...
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
9 years ago
Marc-André Lureau
fbee79ae2f
vrend: fix potential crash with resource 0 creation
...
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
9 years ago
Marc-André Lureau
1146468715
vrend: do not accept to insert resource 0
...
These leads to later crashes
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
9 years ago
Marc-André Lureau
75f71b6f73
vrend: remove unused argument
...
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
9 years ago
Marc-André Lureau
a62554cca9
egl: check eglExportDMABUFImageMESA return value
...
Found thanks to llvm scan-build.
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
9 years ago
Marc-André Lureau
221006de6c
vrend: check eventfd value before close
...
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
9 years ago
Dave Airlie
66708981de
vtest: fail on renderer init failure.
...
This stops us crashing later due to failing to init.
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years ago
Marc-André Lureau
7c3927ce08
vtest: use VIRGL_RENDERER_THREAD_SYNC
...
Built-in EGL supports threaded contexts, so enable sync thread.
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years ago