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

Error in x86(32bit) #26

Open
cargfiloy opened this issue Jun 12, 2023 · 2 comments
Open

Error in x86(32bit) #26

cargfiloy opened this issue Jun 12, 2023 · 2 comments

Comments

@cargfiloy
Copy link

cargfiloy commented Jun 12, 2023

OpenJpegDotNet is perfect in x64 but it's has a problem in x86.
I used your library to encode bitmap file to jpeg2000. However, the following problem occurred in x86.

var buffer = new Buffer
{
Data = outputBuffer,
Length = bufferLength,
Position = 0
};

Data has address, length has imageSize + 1024, Position is zero.
After setting StreamCreate, StreamSetUpdateData, SteamSetUserDataLength and CallBack. I start to encode.

But the following problem occurred in StreamWriteCallBack()

var buf = (Buffer*)userData;

buf->Data has address, buf->Length is zero and buf->position is imageSize + 1024.
I'm wondering why is change Length and Position?
Always buf->Length is zero condition, so it's return unchecked((ulong)-1);

I think maybe the OpenJpegDotNetNative.dll of 32bit and 64bit is different. What do you think?

@cargfiloy cargfiloy reopened this Jun 13, 2023
@takuya-takeuchi
Copy link
Owner

@cargfiloy
In C#, IntPtr.Size is different size between x86 and x64.
Therefore, imageSize + 1024 may occur overlflow.

OpenJpegDotNetNative.dll of 32bit and 64bit is different. What do you think?
Source code is absolutely same and build command is almost same but it should not affect to it.

@cargfiloy
Copy link
Author

cargfiloy commented Jun 13, 2023

@cargfiloy In C#, IntPtr.Size is different size between x86 and x64. Therefore, imageSize + 1024 may occur overlflow.

OpenJpegDotNetNative.dll of 32bit and 64bit is different. What do you think?
Source code is absolutely same and build command is almost same but it should not affect to it.

@takuya-takeuchi
Yes, I know that. IntPtr.Size is 4(x86) or 8(x64).
I mean that Length and Position values are interchanged in StreamWriteCallBack()

For example, at the first call StreamWriteCallBack()
In x64,
image
In x86
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants