lmanul/gimp-texturize

Crash on Windows 10

Closed this issue · 5 comments

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

  • Windows 10 x64 1903
  • GIMP 2.10.14 32bit Portable (samj build)
  • texturize.exe (2.1)

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から呼び出して動作を確認しました。
クラッシュは起きなくなりました。
故に、私の予想は正しいはずです。たぶん。

This patch also includes other fixes.

  • Clicking the cancel button in the dialog will generate an error.
  • Loop optimization of "render.c".

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

  • ダイアログでキャンセルボタンをclickするとエラー。
  • "render.c"のループ最適化。

みえきさん, 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!

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

#5

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 :-)