Clang's static code analysis flagged two warnings against the latest master branch
Closed this issue · 1 comments
kcgen commented
src/info.c
2019-09-26T08:00:56.9597358Z analyze-build: INFO: /home/runner/work/dosbox-staging/dosbox-staging/src/libs/decoders/internal/opusfile/src/info.c:36:40: warning: The left operand of '<<' is a garbage value
2019-09-26T08:00:56.9597900Z analyze-build: INFO: return _data[3]|(opus_uint32)_data[2]<<8|
2019-09-26T08:00:56.9598163Z analyze-build: INFO: ~~~~~~~~^
2019-09-26T08:00:56.9598556Z analyze-build: INFO: /home/runner/work/dosbox-staging/dosbox-staging/src/libs/decoders/internal/opusfile/src/info.c:99:38: warning: Array access (via field 'user_comments') results in a null pointer dereference
2019-09-26T08:00:56.9598874Z analyze-build: INFO: for(ci=ncomments;ci-->0;)_ogg_free(_tags->user_comments[ci]);
2019-09-26T08:00:56.9599514Z analyze-build: INFO: ^~~~~~~~~~~~~~~~~~~~~~~~
2019-09-26T08:00:56.9599753Z analyze-build: INFO: 2 warnings generated.
src/opusfile.c
2019-09-26T07:57:32.7349576Z analyze-build: INFO: /home/runner/work/dosbox-staging/dosbox-staging/src/libs/decoders/internal/opusfile/src/opusfile.c:1754:19: warning: The right operand of '+' is a garbage value
2019-09-26T07:57:32.7350892Z analyze-build: INFO: return pcm_total+diff-links[_li].head.pre_skip;
2019-09-26T07:57:32.7351457Z analyze-build: INFO: ^~~~~
2019-09-26T07:57:32.7352052Z analyze-build: INFO: /home/runner/work/dosbox-staging/dosbox-staging/src/libs/decoders/internal/opusfile/src/opusfile.c:1790:42: warning: Division by zero
2019-09-26T07:57:32.7352587Z analyze-build: INFO: return (opus_int32)((_bytes+(den>>1))/den);
2019-09-26T07:57:32.7353082Z analyze-build: INFO: ~~~~~~~~~~~~~~~~~^~~~
2019-09-26T07:57:32.7354328Z analyze-build: INFO: /home/runner/work/dosbox-staging/dosbox-staging/src/libs/decoders/internal/opusfile/src/opusfile.c:2407:22: warning: 2nd function call argument is an uninitialized value
2019-09-26T07:57:32.7355122Z analyze-build: INFO: bisect=begin+op_rescale64(diff,diff2,end-begin)-OP_CHUNK_SIZE;
2019-09-26T07:57:32.7355805Z analyze-build: INFO: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2019-09-26T07:57:32.7356576Z analyze-build: INFO: /home/runner/work/dosbox-staging/dosbox-staging/src/libs/decoders/internal/opusfile/src/opusfile.c:2655:10: warning: The left operand of '>' is a garbage value
2019-09-26T07:57:32.7357374Z analyze-build: INFO: if(diff>skip)return OP_EBADLINK;
2019-09-26T07:57:32.7358556Z analyze-build: INFO: ~~~~^
2019-09-26T07:57:32.7360386Z analyze-build: INFO: /home/runner/work/dosbox-staging/dosbox-staging/src/libs/decoders/internal/opusfile/src/opusfile.c:2789:9: warning: Null pointer passed as an argument to a 'nonnull' parameter
2019-09-26T07:57:32.7360898Z analyze-build: INFO: ret=opus_multistream_decode_float(_of->od,
2019-09-26T07:57:32.7361162Z analyze-build: INFO: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2019-09-26T07:57:32.7361894Z analyze-build: INFO: /home/runner/work/dosbox-staging/dosbox-staging/src/libs/decoders/internal/opusfile/src/opusfile.c:2819:9: warning: Null pointer passed as an argument to a 'nonnull' parameter
2019-09-26T07:57:32.7362272Z analyze-build: INFO: memcpy(_pcm,_of->od_buffer+nchannels*od_buffer_pos,
2019-09-26T07:57:32.7362536Z analyze-build: INFO: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2019-09-26T07:57:32.7362920Z analyze-build: INFO: /home/runner/work/dosbox-staging/dosbox-staging/src/libs/decoders/internal/opusfile/src/opusfile.c:2887:15: warning: Null pointer passed as an argument to a 'nonnull' parameter
2019-09-26T07:57:32.7363218Z analyze-build: INFO: memmove(_pcm,_pcm+od_buffer_pos*nchannels,
2019-09-26T07:57:32.7363478Z analyze-build: INFO: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2019-09-26T07:57:32.7363712Z analyze-build: INFO: 7 warnings generated.
rillian commented
These should be addressed now. Please open new bugs if you find more issues. Thanks for the report!