Skip to content

WebPDecoder::readData() potential use of uninitialized variable #27456

@chacha21

Description

@chacha21

System Information

OpenCV 4.11.0

Detailed description

In the following code https://github.com/sturkmen72/opencv/blob/538b99f9f3e3b89cfdc363f8afc7ad4cf21b0ba0/modules/imgcodecs/src/grfmt_webp.cpp

/grfmt_webp.cpp)

bool WebPDecoder::readData(Mat &img)
{
    ...
    if (m_has_animation)
    {
        uint8_t* buf;
        int timestamp;

        WebPAnimDecoderGetNext(anim_decoder.get(), &buf, &timestamp);
        Mat tmp(Size(m_width, m_height), CV_8UC4, buf);
        ...

buf and timestamp can remain uninitialized if WebPAnimDecoderGetNext() fails.
buf should be checked before going any further.

Steps to reproduce

Compiling with VIsual studio raises a warning about potential use of uninitialized variable

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy