Ticket #3370 (new defect)

Opened 2 years ago

Last modified 11 months ago

Division by zero in AGG renderer

Reported by: tamas Owned by: tbonfort
Priority: normal Milestone: 5.6.6 release
Component: AGG Version: 5.4
Severity: critical Keywords:
Cc:

Description

In certain circumstances we get systematic division by zero errors in the AGG renderer. In an example we specify a vector symbol with symbol->sizex = 1 and symbol->sizey = 7 and set the actulal size of the symbol to 3. In this case the following calculation causes the actual size is set to zero:

double d = size/symbol->sizey; /* size ~ height in pixels */ int pw = MS_NINT(symbol->sizex*d); //pw = 0 in this case int ph = MS_NINT(symbol->sizey*d);

Having pw = 0 causes a crash in agg_image_accessor.h

wrap_mode_repeat(unsigned size) :

m_size(size), m_add(size * (0x3FFFFFFF / size)), m_value(0)

{}

I attach a fix for this issue

Attachments

mapagg.cpp.patch Download (2.0 KB) - added by tamas 2 years ago.

Change History

follow-up: ↓ 2   Changed 2 years ago by tbonfort

Tamas,

I don't think this is an appropriate fix, as we only want to do a solid fill if the symbol is less than 1px for *both* dimensions. It would be preferable to set the dimension equals to 0 back to 1 if the other dimension is over 1.

regards,

thomas

Changed 2 years ago by tamas

in reply to: ↑ 1   Changed 2 years ago by tamas

Thomas,

I've attached the modified patch regarding the comments below. I would volunteer to apply this or something similar if you don't have time for a fix, just to keep the things going before the next release.

Replying to tbonfort:

Tamas, I don't think this is an appropriate fix, as we only want to do a solid fill if the symbol is less than 1px for *both* dimensions. It would be preferable to set the dimension equals to 0 back to 1 if the other dimension is over 1. regards, thomas

  Changed 11 months ago by dmorissette

Thomas, Tamas, is this still an issue for MapServer 6?

  Changed 11 months ago by tbonfort

  • milestone changed from 5.4.3 release to 5.6.6 release

fixed in trunk in r11313. Tamas can you confirm ?

this is still an issue in 5.6

Note: See TracTickets for help on using tickets.