[BUG] TextureSystem: sample with gray_to_rgb possible crash if there are filesystem errors
メンテナーはふだん 3 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 38/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- cpp
調査の方向性
TextureSystemImpl::texture から開始し、sample_bilinear、ImageCacheImpl::find_tile、ImageCacheFile::mark_broken を通じて ImageSpec 参照を追跡します。ファイルシステムのオープンに失敗する UDIM パスを再現し、その後、グレーチャネルの充填が無効化されたデータにアクセスしなくなっていること、および通常のテクスチャサンプリングに変更がないことを確認します。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
Been playing around with TextureSystem, and (for other reasons that I'm looking into) there have been spurious filesystem errors (due to too many open files - without setting max_open_files_strict in my use case the actual opened file count went way over the max_open_files of 100, and up to 510, at which point Windows MSVC runtime says "nope" for further file opens).
But, once that happens, the ImageCacheFile::mark_broken is called, which clears m_subimages. This invalidates the spec reference that the texture sampling function has locally.
Here's the problematic place:
TextureSystemImpl::texturedoestexturefile = verify_texturefile(fine), and thenconst ImageSpec& spec(texturefile->spec(options.subimage, 0))-- note that this is a reference- Later on, for an UDIM texture, the sampling callstack can end up being:
TextureSystemImpl::sample_bilinear ImageCacheImpl::find_tile ImageCacheImpl::find_tile_main_cache ImageCacheImpl::add_tile_to_cache # needs to read a different udim tile file! ImageCacheTile::read ImageCacheFile::read_tile ImageCacheFile::open # if this fails for whatever reason (my case: too many open files), ImageCacheFile::mark_broken # this invalidates the ImageSpec fetched above - Now, right before the filtering lookup if
fill_gray_channelsis called, this will readspecthat points to free'd memory.
OpenImageIO version and dependencies
2.5.11.0, but looking at file history of latest 3.0.0 the problem seems to exist there too.
To Reproduce
Reproducing is a bit involved since it needs ImageCacheFile::open to be failing. Whether that is due to too many open files (my case), or network/disk connectivity, etc. And it needs to be failing whereas the parent file check earlier in the texture function succeeds; which I think can only happen with UDIM textures.
I could "easily" reproduce this by using the Animal Logic ALab 2.2 data set, which is all UDIM exr files, on Windows MSVC with default open file limit of 100 (OIIO starts to use up to 500 open files, at which point this blows up). Setting max_open_files_strict makes this problem go away.
Evidence
I think the callstack and code flow outline above should point out the possible issue. Probably could be fixed by changing fill_gray_channels to not use the reference of the ImageSpec, but rather directly get the int nchannels and int alpha_channel, and the calling code reading those right after it gets the spec reference, so that they are not invalidated.
- 主要言語
- C++
- スター
- 2.4k
- フォーク
- 727
- 平均マージ
- 4日 8時間
- マージ済み PR(30日)
- 67
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
AcademySoftwareFoundation/OpenImageIO のほかの issue
-
bug: Python ImageBuf.get_pixels(oiio.UNKNOWN) returns None silently or segfaults再び着手できるかも @stevwya77 が 10 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンbug good first issue python
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
AcademySoftwareFoundation/OpenImageIO#5698 · コメント 3 件 ·
メンテナーはふだん 3 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
AcademySoftwareFoundation/OpenImageIO#5619 · コメント 2 件 ·
メンテナーはふだん 3 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 10/100
AcademySoftwareFoundation/OpenImageIO#5570 ·
メンテナーはふだん 3 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
AcademySoftwareFoundation/OpenImageIO#5558 ·
メンテナーはふだん 3 日以内に返信
-
define which color metadata OpenImageIO trusts, and when it resolves it対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
AcademySoftwareFoundation/OpenImageIO#5516 ·
メンテナーはふだん 3 日以内に返信
AcademySoftwareFoundation/OpenImageIO の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
component: tabs platform: macOS
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
zen-browser/desktop#16860 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
windirstat/windirstat#776 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
godotengine/godot#125913 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100