Ticket #3370 (new defect)
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

