Merge pull request #767 from julienmalik/fix_memset_null_pointer

Fix UBSan gcc warning for first arg to memset non null
This commit is contained in:
julienmalik 2016-05-02 14:34:32 +02:00
commit ba0cf122f6
1 changed files with 4 additions and 1 deletions

View File

@ -1180,7 +1180,10 @@ static OPJ_BOOL opj_t1_allocate_buffers(
} }
t1->datasize=datasize; t1->datasize=datasize;
} }
memset(t1->data,0,datasize * sizeof(OPJ_INT32)); /* memset first arg is declared to never be null by gcc */
if (t1->data != NULL) {
memset(t1->data,0,datasize * sizeof(OPJ_INT32));
}
} }
t1->flags_stride=w+2; t1->flags_stride=w+2;
flagssize=t1->flags_stride * (h+2); flagssize=t1->flags_stride * (h+2);