bugGNU Octave - Bugs: bug #65414, fftn.cc, fft2.cc: Fix input...


bug #65414: fftn.cc, fft2.cc: Fix input validation for zero-dimensional input data

Submitter:  Hg200 <hg200>
Submitted:  Mon 04 Mar 2024 07:27:39 PM UTC
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Fixed Assigned to:  None
Originator Name:  HG200 Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  10.1.0 (current default) Planned Release:  10.1.0 (current default)
* Mandatory Fields

Add a New Comment Rich Markup

Mon 04 Mar 2024 09:48:31 PM UTC, comment #2: 

Confirmed.  I also note that fftn has the same problem and emits the same error message from FFTW planner.  I added fixes for fftn, fft2 to your original changeset and updated the commit message.  I checked it in here https://hg.savannah.gnu.org/hgweb/octave/rev/6e67f10b4d33.

Marking bug as Fixed and closing report.

Rik <rik5>
Group administrator
Mon 04 Mar 2024 08:02:52 PM UTC, comment #1: 

attaching patch

(file #55782)

Hg200 <hg200>
Mon 04 Mar 2024 07:27:39 PM UTC, original submission:  

If we call ifftn () with an input array containing zero dimensions, the input data is passed straight down to oct-fftw.cc.

ifftn (ones (2, 0))

This case is catched by the fftw planner with the message

error: Error creating FFTW plan

but this can be unpredictable since catching invalid data formats by internal code is not good practice. In this case Matlab returns an empty matrix with the same size as the input array.

The command

ifft2 (ones (5, 4, 3, 0, 4))

also passes the input validation. I haven't checked where it is actually catched.

The correction of the input validation is a prerequisite for solving bug #43742 (ifft symmetric flag). The code that will be added will require greater zero dimensions of the input data. Please find attached my patch proposal.

Hg200 <hg200>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files


Depends on the following items: None found

   bug dependencies.


Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by hg200 (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.


    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-03-05 nrjank Dependencies- bugs #43742 is dependent
    2024-03-04 rik5 Item GroupInaccurate Result Unexpected Error or Warning
        StatusNone Fixed
        Open/ClosedOpen Closed
        Releaseother dev
        Fixed ReleaseNone 10.1.0 (current default)
        Planned ReleaseNone 10.1.0 (current default)
    2024-03-04 hg200 Attached File- Added bug65414_zero_dimensional_input_fft.diff, #55782

    Back to the top

    Powered by Savane 3.13-b921.
    Corresponding source code