Opened 14 years ago
Last modified 13 years ago
#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
Attachments (1)
Change History (5)
follow-up: 2 comment:1 by , 14 years ago
by , 14 years ago
Attachment: | mapagg.cpp.patch added |
---|
comment:2 by , 14 years ago
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
comment:4 by , 13 years ago
Milestone: | 5.4.3 release → 5.6.6 release |
---|
fixed in trunk in r11313. Tamas can you confirm ?
this is still an issue in 5.6
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