Skip to content

Segfault when reading invalid TGA data #2928

@mwestphal

Description

@mwestphal

Describe the bug
F3D added support for displaying images as texture recently, however when providing an invalid image, it can segfault

To Reproduce
Steps to reproduce the behavior:

  1. Download this file autzen.zip
  2. Open the file using f3d --no-config --force-reader=TGA autzen.pts
  3. segfault/assert
Thread 1 "f3d" received signal SIGABRT, Aborted.
0x00007ffff70a7a2c in ?? () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007ffff70a7a2c in ?? () from /usr/lib/libc.so.6
#1  0x00007ffff704d1a0 in raise () from /usr/lib/libc.so.6
#2  0x00007ffff70345fe in abort () from /usr/lib/libc.so.6
#3  0x00007ffff729a41f in std::__glibcxx_assert_fail(char const*, int, char const*, char const*) () from /usr/lib/libstdc++.so.6
#4  0x00007ffff2e9fca2 in std::vector<unsigned char, std::allocator<unsigned char> >::operator[] (this=0x7fffffffb6f0, __n=557) at /usr/include/c++/15.2.1/bits/stl_vector.h:1263
#5  0x00007ffff3015e13 in operator() (__closure=0x7fffffffb6e0, currentIndex=@0x7fffffffb688: 554, buffer=@0x7fffffffb680: 0x7fff5d7591f4 "00\n") at /home/glow/dev/vtk/vtk1/src/IO/Image/vtkTGAReader.cxx:125
#6  0x00007ffff3016400 in vtkTGAReader::ExecuteDataWithInformation (this=0x555556319090, output=0x555555e01de0, outInfo=0x555556319370) at /home/glow/dev/vtk/vtk1/src/IO/Image/vtkTGAReader.cxx:165
#7  0x00007fffec4be741 in vtkImageAlgorithm::RequestData (this=0x555556319090, request=0x55555631a520, outputVector=0x555556319b30) at /home/glow/dev/vtk/vtk1/src/Common/ExecutionModel/vtkImageAlgorithm.cxx:61
#8  0x00007fffec4be7f6 in vtkImageAlgorithm::ProcessRequest (this=0x555556319090, request=0x55555631a520, inputVector=0x0, outputVector=0x555556319b30) at /home/glow/dev/vtk/vtk1/src/Common/ExecutionModel/vtkImageAlgorithm.cxx:83
#9  0x00007fffec4a77fa in vtkExecutive::CallAlgorithm (this=0x555556319a00, request=0x55555631a520, direction=1, inInfo=0x0, outInfo=0x555556319b30) at /home/glow/dev/vtk/vtk1/src/Common/ExecutionModel/vtkExecutive.cxx:723
#10 0x00007fffec49918d in vtkDemandDrivenPipeline::ExecuteData (this=0x555556319a00, request=0x55555631a520, inInfo=0x0, outInfo=0x555556319b30) at /home/glow/dev/vtk/vtk1/src/Common/ExecutionModel/vtkDemandDrivenPipeline.cxx:447
#11 0x00007fffec48cfd5 in vtkCompositeDataPipeline::ExecuteData (this=0x555556319a00, request=0x55555631a520, inInfoVec=0x0, outInfoVec=0x555556319b30) at /home/glow/dev/vtk/vtk1/src/Common/ExecutionModel/vtkCompositeDataPipeline.cxx:151
#12 0x00007fffec4986e5 in vtkDemandDrivenPipeline::ProcessRequest (this=0x555556319a00, request=0x55555631a520, inInfoVec=0x0, outInfoVec=0x555556319b30) at /home/glow/dev/vtk/vtk1/src/Common/ExecutionModel/vtkDemandDrivenPipeline.cxx:246
#13 0x00007fffec56c6fb in vtkStreamingDemandDrivenPipeline::ProcessRequest (this=0x555556319a00, request=0x55555631a520, inInfoVec=0x0, outInfoVec=0x555556319b30)
    at /home/glow/dev/vtk/vtk1/src/Common/ExecutionModel/vtkStreamingDemandDrivenPipeline.cxx:331
#14 0x00007fffec498f61 in vtkDemandDrivenPipeline::UpdateData (this=0x555556319a00, outputPort=0) at /home/glow/dev/vtk/vtk1/src/Common/ExecutionModel/vtkDemandDrivenPipeline.cxx:404

Expected behavior
No segfault, potentially an error.

System Information:

  • OS: Any
  • GPU and GPU driver: Any

F3D Information
Paste the content of f3d --version or f3d-console.exe --version on Windows: master

Additional context
Add any other context about the problem here.

Fix must be in VTK

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions