[FFmpeg-cvslog] lavfi/dnn/dnn_io_proc.c: Fix Out-of-bounds access (ARRAY_VS_SINGLETON)

2021-05-17 Thread Guo , Yejun
ffmpeg | branch: master | Guo, Yejun  | Tue May 11 
12:31:02 2021 +0800| [bd6ea9ed1d7110601a83722b94c5a2d66feb511d] | committer: 
Guo, Yejun

lavfi/dnn/dnn_io_proc.c: Fix Out-of-bounds access (ARRAY_VS_SINGLETON)

fix coverity CID 1473571, 1473577 and 1482089

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bd6ea9ed1d7110601a83722b94c5a2d66feb511d
---

 libavfilter/dnn/dnn_io_proc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavfilter/dnn/dnn_io_proc.c b/libavfilter/dnn/dnn_io_proc.c
index 1e2bef3f9a..d5d2654162 100644
--- a/libavfilter/dnn/dnn_io_proc.c
+++ b/libavfilter/dnn/dnn_io_proc.c
@@ -154,7 +154,7 @@ static DNNReturnType 
proc_from_frame_to_dnn_frameprocessing(AVFrame *frame, DNND
 }
 sws_scale(sws_ctx, (const uint8_t **)frame->data,
frame->linesize, 0, frame->height,
-   (uint8_t * const*)(&input->data),
+   (uint8_t * const [4]){input->data, 0, 0, 0},
(const int [4]){frame->width * sizeof(float), 0, 0, 
0});
 sws_freeContext(sws_ctx);
 break;
@@ -236,7 +236,7 @@ DNNReturnType ff_frame_to_dnn_classify(AVFrame *frame, 
DNNData *input, uint32_t
 
 sws_scale(sws_ctx, (const uint8_t *const *)&bbox_data, frame->linesize,
0, height,
-   (uint8_t *const *)(&input->data), linesizes);
+   (uint8_t *const [4]){input->data, 0, 0, 0}, linesizes);
 
 sws_freeContext(sws_ctx);
 
@@ -266,7 +266,7 @@ static DNNReturnType 
proc_from_frame_to_dnn_analytics(AVFrame *frame, DNNData *i
 }
 
 sws_scale(sws_ctx, (const uint8_t *const *)frame->data, frame->linesize, 
0, frame->height,
-   (uint8_t *const *)(&input->data), linesizes);
+   (uint8_t *const [4]){input->data, 0, 0, 0}, linesizes);
 
 sws_freeContext(sws_ctx);
 return DNN_SUCCESS;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] lavfi/vf_dnn_processing.c: fix CID 1460603

2021-05-17 Thread Guo , Yejun
ffmpeg | branch: master | Guo, Yejun  | Tue May 11 
14:05:18 2021 +0800| [4718d74c5888457bca49aa02187841905e259d57] | committer: 
Guo, Yejun

lavfi/vf_dnn_processing.c: fix CID 1460603

CID 1460603 (#1 of 1): Improper use of negative value (NEGATIVE_RETURNS)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4718d74c5888457bca49aa02187841905e259d57
---

 libavfilter/vf_dnn_processing.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavfilter/vf_dnn_processing.c b/libavfilter/vf_dnn_processing.c
index e05d59a649..e1d9d24683 100644
--- a/libavfilter/vf_dnn_processing.c
+++ b/libavfilter/vf_dnn_processing.c
@@ -225,6 +225,9 @@ static int copy_uv_planes(DnnProcessingContext *ctx, 
AVFrame *out, const AVFrame
 uv_height = AV_CEIL_RSHIFT(in->height, desc->log2_chroma_h);
 for (int i = 1; i < 3; ++i) {
 int bytewidth = av_image_get_linesize(in->format, in->width, i);
+if (bytewidth < 0) {
+return AVERROR(EINVAL);
+}
 av_image_copy_plane(out->data[i], out->linesize[i],
 in->data[i], in->linesize[i],
 bytewidth, uv_height);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] lavfi/dnn/dnn_io_proc.c: fix Improper use of negative value (NEGATIVE_RETURNS)

2021-05-17 Thread Guo , Yejun
ffmpeg | branch: master | Guo, Yejun  | Tue May 11 
13:46:49 2021 +0800| [3fb1d2e71c1c92ce282b373cd0319bfec56be2db] | committer: 
Guo, Yejun

lavfi/dnn/dnn_io_proc.c: fix Improper use of negative value (NEGATIVE_RETURNS)

fix coverity CID 1473511 and 1473566

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3fb1d2e71c1c92ce282b373cd0319bfec56be2db
---

 libavfilter/dnn/dnn_io_proc.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavfilter/dnn/dnn_io_proc.c b/libavfilter/dnn/dnn_io_proc.c
index d5d2654162..02c8e13ed7 100644
--- a/libavfilter/dnn/dnn_io_proc.c
+++ b/libavfilter/dnn/dnn_io_proc.c
@@ -28,6 +28,9 @@ DNNReturnType ff_proc_from_dnn_to_frame(AVFrame *frame, 
DNNData *output, void *l
 {
 struct SwsContext *sws_ctx;
 int bytewidth = av_image_get_linesize(frame->format, frame->width, 0);
+if (bytewidth < 0) {
+return DNN_ERROR;
+}
 if (output->dt != DNN_FLOAT) {
 avpriv_report_missing_feature(log_ctx, "data type rather than 
DNN_FLOAT");
 return DNN_ERROR;
@@ -98,6 +101,9 @@ static DNNReturnType 
proc_from_frame_to_dnn_frameprocessing(AVFrame *frame, DNND
 {
 struct SwsContext *sws_ctx;
 int bytewidth = av_image_get_linesize(frame->format, frame->width, 0);
+if (bytewidth < 0) {
+return DNN_ERROR;
+}
 if (input->dt != DNN_FLOAT) {
 avpriv_report_missing_feature(log_ctx, "data type rather than 
DNN_FLOAT");
 return DNN_ERROR;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".