lmanul / gimp-texturize

Texturize plugin for the GIMP
GNU General Public License v2.0
9 stars 5 forks source link

Crash on Windows 10 #4

Closed mieki256 closed 2 years ago

mieki256 commented 4 years ago

When gimp-texturize runs on Windows 10, it crashes. It does not always crash. Sometimes it ends normally. Increasing the size of the output image increases the chance of a crash.

gimp-texturize が Windows 10上で crash します。 必ず crash するわけではありません。 正常終了する時もあります。 出力画像サイズを大きくすると、クラッシュする確率が高まります。

Environment

Supplement

I looked at the source code and found the cause. There is "difference()" in "offset.c". "Patch_ptr" and "image_ptr" of "difference()" may exceed the buffer size of "patch" and "image". The memory contents of the undefined area are read. Crash when trying to read a value from a memory address that should not be accessed.

ソースコードを眺めて原因を見つけました。 "offset.c" 内に "difference()" があります。 "difference()" の中の、patch_ptr と image_ptr が、 patch と image のバッファサイズを超える時があります。 不定領域のメモリ内容が読まれます。 稀に、アクセスしてはいけないメモリアドレスから値を読もうとして、クラッシュします。

An attempt was made to avoid exceeding the buffer size. I built with MSYS2 + mingw32 and got texturize.exe. I called it from GIMP and checked the operation. The crash no longer occurs. So my expectations should be correct. I guess.

私は、バッファサイズを超えないように修正を試みました。 MSYS2 + mingw32 を使ってビルドして、texturize.exe を得ました。 GIMPから呼び出して動作を確認しました。 クラッシュは起きなくなりました。 故に、私の予想は正しいはずです。たぶん。

mieki256 commented 4 years ago

gimp-texturize.patch.txt

mieki256 commented 4 years ago

This patch also includes other fixes.

このパッチには、他の修正も含まれいています。

lmanul commented 4 years ago

みえきさん, thank you so much for looking into this! Do you think you could create a pull request from this patch? Then I would be glad to merge it :-) Thank you!

mieki256 commented 4 years ago

I sent a pull request. I am not used to using github. Sorry if there is a mistake.

https://github.com/lmanul/gimp-texturize/pull/5

lmanul commented 2 years ago

Since the pull request was merged, I will assume that this is now fixed -- sorry for the delay in cleaning this up. And thank you so much @mieki256 for your contribution :-)