Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] When using ImageBuf, this file reports a divide-by-zero exception error. Please take a look #4185

Open
cool2528 opened this issue Mar 12, 2024 · 2 comments
Labels
bug Crash or wrong behavior of an existing feature. difficulty/easy Hours-to-days for veterans, days for newcomers to the project help wanted A task that is desired, but needs somebody to commit the effort to implement it. texture / image cache ImageCache, TextureSystem, maketx

Comments

@cool2528
Copy link

Describe the bug

When using ImageBuf, this file reports a divide-by-zero exception error. Please take a look
This is a sample file.
XPPen_new_logo.zip

OpenImageIO version and dependencies
v2.4.13.0

To Reproduce

Execute the following code:

	ImageCache *cache = ImageCache::create ()
	auto inp = ImageBuf(path, cache);
	if (inp.has_error()) {
	std::cout << "parser: open image error: "  << inp.geterror() << std::endl;
	return nullptr;
}

Evidence
373c84ac874a40132f3c7c566b4fb2c

@lgritz lgritz added bug Crash or wrong behavior of an existing feature. texture / image cache ImageCache, TextureSystem, maketx help wanted A task that is desired, but needs somebody to commit the effort to implement it. difficulty/easy Hours-to-days for veterans, days for newcomers to the project labels May 14, 2024
@sumana-2705
Copy link

sumana-2705 commented Jun 27, 2024

@lgritz @cool2528 Can I take up this issue?

@cool2528
Copy link
Author

cool2528 commented Jun 27, 2024

@lgritz I found that the issue is consistently reproducible when using the autotile attribute. This is a new test code. The previous code I provided might not exhibit this issue in the new version. I apologize for this.

#include <iostream>
#include "OpenImageIO/imagebuf.h"
#include "OpenImageIO/imageio.h"
#include "OpenImageIO/imagecache.h"

int main()
{
	OIIO::ImageCache* cache = nullptr;
	cache = OIIO::ImageCache::create(false);
	cache->attribute("autotile", 64);
	std::thread t([&]
	{
			OIIO::ImageBuf img(R"(C:\Users\Administrator\Desktop\bug\XPPen_new_logo\XPPen_new_logo.ico)", cache);
			if (img.has_error())
			{
				std::cerr << "Error reading image  error " << img.geterror() << std::endl;
				return;
			}
			const auto& spec = img.spec();

			std::cout << "image width " << spec.width << "  image height " << spec.height << " channel " << spec.nchannels << std::endl;
	});
	t.join();
	OIIO::ImageCache::destroy(cache);
	return 0;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Crash or wrong behavior of an existing feature. difficulty/easy Hours-to-days for veterans, days for newcomers to the project help wanted A task that is desired, but needs somebody to commit the effort to implement it. texture / image cache ImageCache, TextureSystem, maketx
Projects
None yet
Development

No branches or pull requests

3 participants