bugGNU Octave - Bugs: bug #52041, imfinfo error when extension...

 
 

bug #52041: imfinfo error when extension specified as second argument

Submitter:  None
Submitted:  Fri 15 Sep 2017 01:34:07 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * other
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 19 Sep 2017 05:41:02 PM UTC, comment #6: 

Thanks, sorry I didn't get back to this over the weekend.

Mike Miller <mtmiller>
Group Member
Mon 18 Sep 2017 07:53:29 PM UTC, comment #5: 

I checked the change in under Mike's name here http://hg.savannah.gnu.org/hgweb/octave/rev/6782105f1820.  Marking as fixed and closing report.

Rik <rik5>
Group administrator
Fri 15 Sep 2017 06:35:52 PM UTC, comment #4: 

I created some input validation tests for imfinfo.  See the attached 52041.diff.  I think you just need to slap on a commit message and submit it.  It should go on stable.

(file #41812)

Rik <rik5>
Group administrator
Fri 15 Sep 2017 05:19:51 PM UTC, comment #3: 

I can confirm that the simple change suggested works:


diff --git a/scripts/image/imfinfo.m b/scripts/image/imfinfo.m
--- a/scripts/image/imfinfo.m
+++ b/scripts/image/imfinfo.m
@@ -154,7 +154,7 @@ function info = imfinfo (filename, varar
     print_usage ();
   elseif (! ischar (filename))
     error ("imfinfo: FILENAME must be a string");
-  elseif (nargin > 1 && ! ischar (ext))
+  elseif (nargin > 1 && ! ischar (varargin{1}))
     error ("imfinfo: EXT must be a string");
   endif


but I would like to add a test case to this. If someone comes up with a test case faster than I can please share it.

Mike Miller <mtmiller>
Group Member
Fri 15 Sep 2017 04:10:43 PM UTC, comment #2: 

This used to work in Octave 3.8 but was broken sometime before the Octave 4.0 release and has been since. A test case should be added for this calling form as well.

Mike Miller <mtmiller>
Group Member
Fri 15 Sep 2017 04:08:03 PM UTC, comment #1: 

Confirmed, the imfinfo function uses a local variable "ext" but the function arguments take a varargin.


>> inf = imfinfo ("foo.png");     ## ok
>> imf = imfinfo ("foo", "png");  ## error


Mike Miller <mtmiller>
Group Member
Fri 15 Sep 2017 01:34:07 PM UTC, original submission:  

Bug seems to be on line 157 of imfinfo.m, i.e. replacing

! ischar (ext)

with

! ischar (varargin{1})

seems to work

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #41812:  52041.diff added by rik5 (784B - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    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
    2017-09-18 rik5 StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2017-09-15 rik5 Attached File- Added 52041.diff, #41812
        StatusConfirmed In Progress
    2017-09-15 mtmiller CategoryOctave Package Octave Function
        Item GroupUnexpected Error or Warning Incorrect Result
        StatusNone Confirmed
        Summaryimage: imfinfo crashes if extension specified imfinfo error when extension specified as second argument

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code