glsl/blob: Do not call memcpy if there is nothing to copy
authorDanylo Piliaiev <danylo.piliaiev@globallogic.com>
Tue, 28 Jan 2020 14:53:02 +0000 (16:53 +0200)
committerDanylo Piliaiev <danylo.piliaiev@globallogic.com>
Wed, 19 Feb 2020 10:07:24 +0000 (12:07 +0200)
commitd800bcd9b9664dbb0c8476ee628a3eb888802b87
tree619f2da4400b0f0bc3b77200090c7d55efb11f20
parent7685f48ece721960f6cbb105fca9ea60d256d200
glsl/blob: Do not call memcpy if there is nothing to copy

../src/util/blob.c:166:7: runtime error: null pointer passed as argument 2, which is declared to never be null
    #0 0x7fe51bc315df in blob_write_bytes ../src/util/blob.c:166
    #1 0x7fe51c7a7b9a in iris_disk_cache_store ../src/gallium/drivers/iris/iris_disk_cache.c:115
    #2 0x7fe51c7f444d in iris_compile_fs ../src/gallium/drivers/iris/iris_program.c:1693
    #3 0x7fe51c7fdcd9 in iris_create_fs_state ../src/gallium/drivers/iris/iris_program.c:2331
    #4 0x7fe519e871a3 in st_create_fp_variant ../src/mesa/state_tracker/st_program.c:1275
    #5 0x7fe519e89dd0 in st_get_fp_variant ../src/mesa/state_tracker/st_program.c:1435
    #6 0x7fe519ed51e1 in st_update_fp ../src/mesa/state_tracker/st_atom_shader.c:163
    #7 0x7fe519eb5d73 in st_validate_state ../src/mesa/state_tracker/st_atom.c:261
    #8 0x7fe519e4e0bf in prepare_draw ../src/mesa/state_tracker/st_draw.c:132
    #9 0x7fe519e4e76e in st_draw_vbo ../src/mesa/state_tracker/st_draw.c:184
    #10 0x7fe51aca5245 in vbo_save_playback_vertex_list ../src/mesa/vbo/vbo_save_draw.c:215
    #11 0x7fe51a25b1cc in ext_opcode_execute ../src/mesa/main/dlist.c:1126
    #12 0x7fe51a2f8d58 in execute_list ../src/mesa/main/dlist.c:11830
    #13 0x7fe51a34b2d0 in _mesa_CallList ../src/mesa/main/dlist.c:14267

Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3825>
src/util/blob.c