[GRASS-git] [OSGeo/grass] d108b6: r.kappa: Fix failures, garbage output, fallback to...

Māris Nartišs noreply at github.com
Thu Nov 10 04:05:21 PST 2022


  Branch: refs/heads/releasebranch_8_2
  Home:   https://github.com/OSGeo/grass
  Commit: d108b67081394bd65812ae4d57947dc8e51b53b9
      https://github.com/OSGeo/grass/commit/d108b67081394bd65812ae4d57947dc8e51b53b9
  Author: Māris Nartišs <maris.gis at gmail.com>
  Date:   2022-11-10 (Thu, 10 Nov 2022)

  Changed paths:
    M raster/r.kappa/calc_kappa.c
    M raster/r.kappa/prt2csv_mat.c
    A raster/r.kappa/testsuite/data/class_1.ascii
    A raster/r.kappa/testsuite/data/class_2.ascii
    A raster/r.kappa/testsuite/data/ref_1.ascii
    A raster/r.kappa/testsuite/data/ref_2.ascii
    A raster/r.kappa/testsuite/test_r_kappa.py

  Log Message:
  -----------
  r.kappa: Fix failures, garbage output, fallback to category values (#2573)

* use raster category values in matrix output if labels are not present

* print NAs also for the first category
Although original code lacks any explanation why NA should not be
printed for the first raster category, I do suspect it stems from
idea that the first cat is 0 and before proper NULL support 0
was "no data" value.

* r.kappa: fix incorrect memory access and improve edge case handling

pii, pi, pj and pii all are arrays with size of ncat thus when
nstats < ncat it was causing out of bounds reads and writes.
A resulting segfault was reported in:
https://trac.osgeo.org/grass/ticket/3978

* tests for most of functionality




More information about the grass-commit mailing list