Skip to content

BUG: Fixes silent WRONG_DATA and CRASH bugs #1908

Open

Description

@imikejackson

Summary

The filter sweep found a set of defects that do not share a pattern with any other defect. Each one is a local mistake in one filter or in one shared helper. This issue tracks them in one place so that they are not lost. As of develop c26bd47 (2026-11-03), there were 72 findings in 50 filters and 5 other areas: 5 CRASH, 35 WRONG_DATA and 32 MINOR. On 2026-11-04 the list was reorganized: 15 MINOR items moved to #1917, and 7 items (L73 to L79) were added from #1899 and from the review of PR #1915. MINOR defects are tracked in #1917; documentation and comment defects in #1899. On 2026-11-05, item L82 (WRONG_DATA) was added from the review of PR #1923. Items L83 to L98 were added later.

2026-11-13: PRs #1961, #1962, #1965, #1967, #1968, #1969, #1970, #1971 and #1972 were closed and combined into #1973, which is built and tested with the combined EbsdLib branch BlueQuartzSoftware/EbsdLib#86 (it holds EbsdLib #70 to #85, which were closed into it). Items that named one of these pull requests now also name #1973. L89 and L90 are fixed by #1965, which is part of #1973. No item is ticked until #1973 is merged.

Status on 2026-11-12: there are 98 item numbers: 60 open, 20 fixed and 18 struck through.

Every finding is a candidate. An automated code-reading sweep found it (develop 4a7b71e, 2026-10-08), a second code reading confirmed it on develop 419f9db, and every line was checked again on develop c26bd47. Nobody ran the trigger yet. Each checklist line gives the trigger in plain words.

Each finding has a unique item number (L01 to L98). Refer to a finding by this number in commits and pull requests, for example "Fixes #1908 item L07". The numbers do not change; a fixed item is ticked, not removed. A moved item keeps its line, struck through, with its new item number.

Findings marked "6.5.171 errata: KI-###" are also defects in DREAM.3D 6.5.171. They are listed with that ID on the Known Issues in DREAM.3D 6.5.171 page. When one is fixed, update the DREAM3D-NX status of that entry.

#1900 fixed 18 findings of the original sweep before this issue was filed, so they are not listed: ArrayCalculatorFilter#1, BinaryDilateImageFilter#1, ComputeFeaturePhasesBinaryFilter#1, ComputeTriangleGeomVolumesFilter#4, ComputeVectorColorsFilter#1, ConvertColorToGrayScaleFilter#1, CropVertexGeometryFilter#2, FeatureFaceCurvatureFilter#5, PointSampleTriangleGeometryFilter#1, ReadCSVFileFilter#1, ReadH5EbsdFilter#2, ReadVtkStructuredPointsFilter#1, ScalarSegmentFeaturesFilter#3, StandardDeviationProjectionImageFilter#1, TriangleDihedralAngleFilter#1, UncertainRegularGridSampleSurfaceMeshFilter#4, WriteLAMMPSFileFilter#1 and WriteVtkRectilinearGridFilter#2.

Mechanism

There is no common mechanism. Each finding has its own cause, for example integer division, an off-by-one loop start, a missing null check or a wrong copy direction. Some findings are in shared code (SegmentFeatures.cpp, ImageProcessingFilterUtilities.hpp, ImageRotationUtilities.cpp, MorphologyEngine.hpp, RenameDataAction.cpp, UpdateImageGeomAction.cpp). A fix there changes all filters that use that code.

An example (ComputeBoundingBoxStatsFilter, WRONG_DATA, item L10). For an even count, the median is the mean of the two middle values only when the cumulative frequency equals count / 2 + 1 exactly. For the values {1, 1, 2, 2}, the cumulative frequency jumps from 2 to 4, so the median is 2.0 and not 1.5:

ComputeBoundingBoxStatsDirect.cpp#L413-L427

  const usize medianPosition = (stats.count / 2) + 1;
  ...
    if(!state.medianFound && state.cumulativeFrequency >= medianPosition)
    {
      if(stats.count % 2 == 0 && state.cumulativeFrequency == medianPosition && state.previousValue.has_value())
      {
        stats.medianValue = (static_cast<float32>(state.previousValue.value()) + static_cast<float32>(entry.value)) / 2.0f;
      }
      else
      {
        stats.medianValue = static_cast<float32>(entry.value);
      }

Rule

  • Each finding needs its own fix. There is no shared helper for this issue.
  • Every fix starts with a unit test that fails on develop.
  • Put checks in preflight when they do not need array values. Put value checks in execute.
  • When a new preflight check makes an execute-time check unreachable, remove the execute-time check.

How to fix

  1. Pick one checklist line. Read the code at the permalink and the finding id.
  2. Write the failing test first (see "How to test").
  3. Make the smallest change that fixes the trigger. Each checklist line names the cause.
  4. If the fix is in shared code, run the tests of every filter that uses that code.
  5. A new filter error code must be more negative than -10000 and must be in the range that the filter already uses. Check that the code is unique with git grep -nE -- "-NNNN([^0-9]|$)" (do not use \b).
  6. If a finding has its own issue (marked "same defect"), fix it under that issue and tick it here.
  7. Name the item number in the commit message and in the pull request, and tick the item here when the pull request merges.

How to test

  • Write the test before the fix. The test must fail on develop.
  • Use the trigger from the checklist line as the test input. Make the input as small as possible (for example a 3x3x3 Image Geometry).
  • CRASH: assert that preflight or execute returns an error and does not crash. For an out-of-bounds read, the test must fail under AddressSanitizer or produce a wrong value before the fix.
  • WRONG_DATA: compare the output values with an independent expected result (oracle), for example a hand calculation or a closed-form value. Do not use the current output of the code as the expected result.
  • For filters with Direct and Scanline algorithms, run the test in both through the existing algorithm-selection test scope (UnitTest::SelectAlgorithmTestScenariosForInMemoryStores() or AlgorithmTestScope).
  • If you cannot reproduce a finding, do not force a fix. Write the reason in the PR and on this issue.

Conventions

  • Use one PR for each group of related fixes (for example all RenameDataAction findings). Use one commit for each filter.
  • Commit prefix BUG:. Add a Signed-off-by line. Do not add AI attribution.
  • Every fix starts with a unit test that fails on develop.
  • Value checks need an independent expected result (oracle), not the output of the code.
  • Run ctest serially. Never use -j, because the tests depend on each other.
  • Format with clang-format 19.1.1 and the repository .clang-format.
  • Do not add per-filter documentation sentences about input requirements. The generated parameter table documents them.
  • If a fix touches a filter that has a V&V report (src/Plugins/<Plugin>/vv/<Filter>.md), update every file of that V&V package (report, deviations, provenance, test tables). V&V documents reference DREAM3D 6.5.171 only.
  • Rebase on develop. Never merge develop into the branch.

Checklist

The list is grouped by plugin, then by impact. Some findings in the SimplnxCore group are in core library code (src/simplnx/...) that the named filter uses.

SimplnxCore (52 findings: 21 open, 16 fixed, 15 moved to #1917)

CRASH (3: 1 open, 2 fixed)

WRONG_DATA (26: 12 open, 14 fixed)

MINOR (23: 8 open, 15 moved to #1917)

OrientationAnalysis (4 findings: 3 open, 1 fixed)

WRONG_DATA (4: 3 open, 1 fixed)

ImageProcessing (7 findings: 4 open, 3 fixed)

CRASH (1: open)

WRONG_DATA (4: 1 open, 3 fixed)

MINOR (2: open)

Found in the Feature Attribute Matrix clearing review (L64 to L72: 7 open, 2 moved)

These findings come from the review of branch topic/correct_feature_am_updates, and each line was checked on develop 10e4a07.

CRASH (1: moved to #1863)

WRONG_DATA (1: moved to #1867)

MINOR (7: open)

  • L66 · MINOR · SamplingUtils · SamplingUtils.hpp:50 — The -602 message of Sampling::RenumberFeatures (Crop Geometry (Image) and Resample Data with Renumber Features on) says the Feature count comes from the Feature Ids array and names the source array. The count comes from the Feature Attribute Matrix and the value from the destination array. It also prints to std::cout, and -600 and -602 are reused in ScalarSegmentFeatures.cpp. SamplingUtils#1
  • L67 · MINOR · SamplingUtils · SamplingUtils.hpp:38 — Sampling::RenumberFeatures reads the destination Feature Ids one value at a time. With an out-of-core store this is one cache lookup per cell. RemoveInactiveObjects already reads the same array in chunks with copyIntoBuffer. SamplingUtils#2
  • L68 · MINOR · Examples · basic_ebsd_ipf.ipynb:33 — 11 code cells of the notebook are not valid Python, because the module prefix is missing (data_structure = .nxDataStructure()). The other 7 notebooks parse. No test runs the notebooks. Examples#1
  • L69 · MINOR · Docs · EBSDSegmentFeaturesFilter.md:98 — "Example Pipelines" lists name pipelines that do not exist, for example "INL Export" on 9 pages. A name match finds 86 of 148 listed names, on 43 of 69 pages, with no pipeline file of that name. Some are only spelling differences. Docs#1
  • L70 · MINOR · Pipelines · ExtractFeatureBoundaries2D.d3dpipeline:25 — Shipped pipelines and Python scripts use absolute paths from developer machines (/Users/mjackson/...). The same is in AppendImageGeometry.d3dpipeline:277, ebsd_segment_pilot.d3dpipeline:10 and 119, Combine_STL_Files.py:19 and convert_pipeline.py:6. None is a registered test, so the user gets "file does not exist". Pipelines#1
  • L71 · MINOR · Pipelines · ImportEdaxOIMData.d3dpipeline:35 — The pipeline reads Data/Hikari_Ni_Sequence.h5, which is in no Data Archive file and no test data. It is not a registered test. The Python version in examples/pipelines/Incomplete also uses old parameter names. Pipelines#2 — PR BUG: Validate EBSD reader headers, scans and slice ranges #1967 → combined into BUG: Combine the EBSD fixes that need the next EbsdLib release #1973
  • L72 · MINOR · TestUtils · OrientationAnalysisTestUtils.hpp:60 — Eight filter handles are declared but no file uses them (for example k_CropImageGeometryFilterHandle; k_FindNFeaturePhasesFilterHandle and k_FindNeighborsFilterHandle also use old filter names). A reader thinks a test depends on these filters. TestUtils#1

Moved from #1899 and found while reviewing PR #1915 (L73 to L81: 9 open)

Items L73 to L75 come from #1899. Items L76 to L81 were found while reviewing PR #1915. Each line was checked on develop a7dffc4 (2026-11-04), and the links use that commit.

Moved from #1899: WRONG_DATA (2) and ERROR (1)

  • L73 · WRONG_DATA · GrayscaleDilate, GrayscaleErode, GrayscaleMorphologicalOpening, GrayscaleMorphologicalClosing, WhiteTopHat, BlackTopHat, MorphologicalGradient (ImageProcessing) · MorphologyEngine.hpp:384 — On a 2D image (Z = 1) with the Annulus kernel and radius {0, 0, r} (r > 0), every kernel offset is out of plane, so the output is a constant (dilate gives the type minimum, erode gives the type maximum, the gradient gives lowest - max, which is 1 for uint8) and not a copy of the input. (was BUG: Fix DOC and comment defects. #1899 item D01)
  • L74 · WRONG_DATA · FeatureFaceCurvatureFilter · CalculateTriangleGroupCurvatures.cpp:313 — With Use Normals for Curve Fitting on, the cubic fit has 7 unknowns, but the code does not check that the patch has at least 7 triangles, so a small patch gives an underdetermined least-squares fit and the curvature values are arbitrary, with no warning. (was BUG: Fix DOC and comment defects. #1899 item D02)
    • The seed triangle is moved to the origin, so its row in the fit matrix is all zero. In practice the fit needs 7 triangles other than the seed.
    • The quadratic fit (option off, 3 unknowns) has the same problem when the patch has only 2 triangles. On develop, only a patch with fewer than two valid triangles is marked invalid (lines 231-236).
  • L75 · ERROR · ReadVtkStructuredPointsFilter · ReadVtkStructuredPoints.cpp:1114 — The SCALARS component count is read with std::atoi, so a bad value is not detected: abc or 0 gives 0 components, a negative value wraps to a very large usize, and the reader then parses the next header from data bytes and fails with an unrelated error. (was BUG: Fix DOC and comment defects. #1899 item D03)
    • Suggested fix: parse the count with StringInterpretationUtilities::Convert<usize> and reject a count less than 1 with a clear error.

Found while reviewing PR #1915: CRASH (1) and WRONG_DATA (3)

  • L76 · CRASH · ApplyTransformationToGeometryFilter · ImageRotationUtilities.cpp:83 — With Transformation Type = Manual Transformation Matrix or Pre-Computed Transformation Matrix (4x4), a matrix with a zero column (for example a zero X column) gives an output spacing of 0 on that axis. The output dimension is then range / 0, which is inf or NaN. The cast of that value to usize is undefined behavior and gives a very large or random dimension, so the allocation can fail. Preflight (GeometryTransformation.cpp:229) does not check for a singular matrix. BUG: C14: Parameter values not validated in preflight in 65 filters #1873 item 9 covers only the Scale type. RotateSampleRefFrameFilter uses the same code.
  • L77 · WRONG_DATA · AlignSectionsFeatureCentroidFilter · AlignSectionsFeatureCentroid.cpp:136 — With Use Reference Slice on and Store Alignment Shifts on, the Relative Shifts array holds the shift relative to the reference slice. These are the same values as the Cumulative Shifts array (line 183; Scanline lines 387-391). The filter page says "relative to previous shift" (AlignSectionsFeatureCentroidFilter.md:59), and the Align Sections (List) page says to use this array as input (AlignSectionsListFilter.md:59). Align Sections (List) with Input Array Type = Relative adds the values again, so every shift from row 2 on is wrong.
  • L78 · WRONG_DATA · AlignSectionsListFilter · Align_Sections_Backwards_Compatibility.d3dpipeline:91 — The example pipeline imports the 116-row 6.5.171 shift file (Alignment_By_Misorientation_Shifts.txt) for a 117-section volume, with no zero row 0. With Input Array Type = Cumulative, Align Sections (List) applies row i to section 116 - i (AlignSectionsList.cpp:60), but row i of the file holds the shift of section 115 - i. So sections 1 to 115 get the shift of the section below them, section 0 gets no shift, and row 0 is not used. The "Note on Legacy Files" (AlignSectionsListFilter.md:55) does not tell users to add a zero row 0. Preflight gives no error because the row-count check runs only for Relative (AlignSectionsListFilter.cpp:119, tracked in BUG: C07: Preflight/execute or Direct/Scanline disagree in 53 filters #1867). When BUG: C07: Preflight/execute or Direct/Scanline disagree in 53 filters #1867 is fixed, this pipeline fails with -8943 until the file gets its row 0.
  • L79 · WRONG_DATA · ReadImageFilter · ReadImage.cpp:363 — For a multi-page TIFF, the code checks only the byte count of each page segment against page 0 (lines 310-311 and 363-366). A page with the same dimensions and the same bytes per pixel but a different layout passes. Example: page 0 is uint8 RGBA (4 bytes per pixel) and page 1 is float32 grayscale (4 bytes per pixel). The float bytes of page 1 are copied as four uint8 components (lines 389-393), with no error. This is not item L57, where the byte counts differ.

Found in the second review of PR #1915: WRONG_DATA (2)

  • L80 · WRONG_DATA · AlignSectionsFeatureCentroidFilter · AlignSectionsFeatureCentroid.cpp:144 — An Image Geometry with an X or Y spacing of 0 (Create Image Geometry does not reject it) makes each centroid difference divided by the spacing NaN or ±inf. The cast of that value to int64 (lines 136-145, 197-204 and 337-345) is undefined behavior, so the shifts have undefined values. PR BUG: Fix 21 filter defects ported from 'SIMPL' and 'DREAM3D' #1915 gives an empty slice (NaN centroid) a zero shift, but it does not handle a zero spacing.
  • L81 · WRONG_DATA · ReadVtkStructuredPointsFilter · ReadVtkStructuredPoints.cpp:825 — With Read Point Data on, the point Image Geometry uses the file's DIMENSIONS as its cell dimensions and the file's ORIGIN as its origin. Point i is stored in a voxel whose center is ORIGIN + (i + 0.5) × SPACING, so every point value is half a spacing away from its VTK position on every axis. Example: DIMENSIONS 3 3 3, ORIGIN 2 6 10, SPACING 2 6 4. The first point is at (2, 6, 10), but its voxel center is (3, 9, 12). PR BUG: Fix 21 filter defects ported from 'SIMPL' and 'DREAM3D' #1915 centers an axis with one point on its VTK position, but does not change axes with more than one point.

Found while reviewing PR #1923 (L82: open)

Item L82 was found while reviewing PR #1923. It was checked on develop a7dffc4 (2026-11-05), and the links use that commit.

WRONG_DATA (1)

  • L82 · WRONG_DATA · Dream3dIO (full import of a DREAM.3D 6.x file) · Dream3dIO.cpp:792 — When a DREAM.3D 6.x file is imported with preflight off (for example DREAM3D::ImportDataStructureFromFile(path, false)), readLegacyStringArray makes each StringDataArray with StringArray::CreateWithValues and ignores the return value. The array gets one tuple for each string. When the string count is not equal to the tuple count of its Attribute Matrix, AttributeMatrix::canInsert rejects the array (AttributeMatrix.cpp:103), CreateWithValues returns nullptr, and the import succeeds without the array. There is no error and no warning.

Found after 2026-11-05 (L83 to L98: 15 open, 1 not a defect)

Items L83 to L98 were added after 2026-11-05. Most of them come from the filter sweep and say to fix the defect during the V&V of that filter.

CRASH (6: 5 open, L92 not a defect)

WRONG_DATA (8: open)

ERROR (2: open)

Related issues

These open issues describe the same defect, or part of it. Fix the defect under its own issue, then tick the line here.

Out of scope

  • Findings in filters that have a V&V report are not in this issue. There are 7 such findings in 5 filters: CreateFeatureArrayFromElementArrayFilter, DBSCANFilter, GroupMicroTextureRegionsFilter, ReadEbsdPatternFileFilter, WriteDREAM3DFilter. A separate V&V branch handles them.
  • Defects that follow a pattern shared by several filters. Each pattern has its own systemic issue (BUG: C01: Copy-paste index drift in 15 filters #1861 to BUG: C21: Wrong or misleading diagnostics in 10 filters #1880).
  • Some findings match legacy DREAM3D 6.5.171 behavior (for example AlignSectionsFeatureCentroidFilter#4, QuickSurfaceMeshFilter#4). The 6.5.171 errata lists that behavior as a defect, so fix it in DREAM3D-NX and say in the pull request that the output differs from 6.5.171.

Activity

  1. self-assigned this
    on Nov 3, 2026
  2. imikejackson commented on Nov 4, 2026

    @imikejackson
    ContributorAuthor

    PR #1915 fixes the 21 items that are also DREAM.3D 6.5.171 errata entries: L04, L11, L12, L23, L28, L29, L30, L38, L39, L43, L44, L45, L51, L52, L54, L55, L56, L57, L58, L62 and L63. Each item has its own commit with a unit test that fails on develop. They are marked "PR #1915" in the checklist and will be ticked when the PR merges.

    Design decisions made for these items:

    • L51/L52: arrays with more than 4 components are rejected in preflight (-12073 / -12074).
    • L58/L63: the projection filters get a new parameter, Copy Non-Cell Attribute Matrices (default false).
    • L62: the per-slice data-type check runs at the start of execute, so preflight still opens only file 0.
    • L28: the new spacing rule applies only to grid rotations. Other transformations keep the earlier rule.
  3. imikejackson commented on Nov 4, 2026

    @imikejackson
    ContributorAuthor

    This issue now holds CRASH, WRONG_DATA and ERROR defects. 15 MINOR items that no pull request references (L31-L37, L40-L42, L46-L50) moved to #1917; their lines stay here, struck through, with the new item number. New items L73-L75 came from #1899 (2 WRONG_DATA, 1 ERROR) and L76-L79 were found while reviewing #1915 (1 CRASH, 3 WRONG_DATA). MINOR items that a pull request references (#1913, #1915) stay here.

  4. changed the title [-]BUG: Fix one-off defects found by the filter sweep[/-] [+]BUG: Fixes silent WRONG_DATA and CRASH bugs[/+] on Nov 4, 2026
  5. 88 remaining items

  6. added 15 commits that reference this issue on Nov 13, 2026
    3fb7e60
    3f41bc7
    f400b34
    f7516fb
    a95cf0c
    5ebb951
    17c76ac
    a9cae87
    cfa0e7e
    4ca210f
    123c01e
    ae1cab1
    dc6f8ca
    010b34e
    3286a3d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions