Skip to content

Commit

Permalink
Merge pull request #767 from julienmalik/fix_memset_null_pointer
Browse files Browse the repository at this point in the history
Fix UBSan gcc warning for first arg to memset non null
  • Loading branch information
julienmalik committed May 2, 2016
2 parents da56086 + e1e018a commit ba0cf12
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib/openjp2/t1.c
Original file line number Diff line number Diff line change
Expand Up @@ -1180,7 +1180,10 @@ static OPJ_BOOL opj_t1_allocate_buffers(
}
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;
flagssize=t1->flags_stride * (h+2);
Expand Down

0 comments on commit ba0cf12

Please sign in to comment.