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

Māris Nartišs noreply at github.com
Thu Nov 3 10:55:05 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/OSGeo/grass
  Commit: 8dd3ce7d0cb617aaba0335f7294c8f975b3c9ba3
      https://github.com/OSGeo/grass/commit/8dd3ce7d0cb617aaba0335f7294c8f975b3c9ba3
  Author: Māris Nartišs <maris.gis at gmail.com>
  Date:   2022-11-03 (Thu, 03 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