← Back to team overview

hugin-devs team mailing list archive

[Bug 1046863] Re: Exception with output images bigger than 2gigapixel

 

I bet you have not tried it, just 'know' that int is 8 byte long on 64bit system.
Actually sizeof(int)=4 even on 64bit systems. It is clearly stated in the gcc man page at the -m64 switch.

The code piece at the end prints the following on my system:
sizeof(int): 4
sizeof(long): 8
sizeof(long long): 8

This is what comes to my mind when you write about 64bit version of
Enblend. Let me know if you ment something else.

uname -a
Linux tas 3.2.0-29-generic #46-Ubuntu SMP Fri Jul 27 17:03:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

-----------------------------------------
#define PRINT_SIZEOF(t) printf("sizeof(" #t "): %d\n", sizeof(t));

void main(void)
{
  PRINT_SIZEOF(int)
  PRINT_SIZEOF(long)
  PRINT_SIZEOF(long long)
}

-- 
You received this bug notification because you are a member of Hugin
Developers, which is subscribed to Enblend.
https://bugs.launchpad.net/bugs/1046863

Title:
  Exception with output images bigger than 2gigapixel

Status in Enblend:
  Invalid

Bug description:
  enblend throws the following exception when trying to blend panorama
  with more than 2 and less than 4gigapixels:

  enblend: an exception occured
  enblend: 
  Precondition violation!
  BasicImage::resize(int width, int height, value_type const &): width * height too large (integer overflow -> negative).

  The relevant part of the command line is the following:
  enblend -f80696x37979+1539+42210 -o output.tif -- input1.tif input2.tif

  How to reproduce:
  - take more than one tif file with alpha channels. It is needed to pass the loading of the input images
  - specify the output image size with -f widthxheight so that width*height becomes a negative number with 32bit integer arithmetics

  The root cause is in the vigra library. Enblend uses the BasicImage
  class from vigra. The implementation of this class uses integer
  arithmetics to calculate the amount of pixels for memory allocation.
  It also uses 32bit integer arithmetics to calculate offsets to access
  the memory during blending.

  Core dump can be provoked with the following command line, i.e. panorama with more than 4gigapixel:
  enblend -f65537x65536 -o output.tif -- input1.tif input2.tif

  width times height becomes a very small positive number, so the assert
  at the creation of the output image does not trigger any more,
  allowing the offset handling bug(s) in the vigra library to appear.

  I have checked with the following changesets:
  801:05e2d5c343d9 (head of the development git repo of vigra installed: commit c3a600900f31fd8112cf8f90bd510015feb76fbb)
  792:0c303c9ed15b (vigra used from the source tree of enblend)

  The bug exists in both cases. The difference is that the vigra version
  in the 792:.... changeset does not contain the assert for integer
  overflow, so coredump is the result in all of the cases.

  Proposal for fixing: replace the BasicImage class with another (if
  exists) which has no such bugs.

To manage notifications about this bug go to:
https://bugs.launchpad.net/enblend/+bug/1046863/+subscriptions


References