几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量  


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » AutoCAD二次开发 » DirectDWG
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


回复
 
主题工具 搜索本主题 显示模式
旧 2009-05-07, 12:00 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】purify errors in v1.10 dlls

purify errors in v1.10 dlls
purify errors in v1.10 dlls
hi there,
i've just upgraded our product to use dwgdirect v1.10. i use the dll versions of the libraries. we are now seeing random crashes in our tests. i've used purify on the test to spot potential errors and it has shown lots of abr (read beyond array bounds) errors. here's a sample report :
[e] abr: array bounds read in odtextiterator::nextchar(void) {208 occurrences}
reading 1 byte from 0x084b94ed (1 byte at 0x084b94ed illegal)
address 0x084b94ed is 1 byte past the end of a 45 byte block at 0x084b94c0
address 0x084b94ed points to a c++ new block
thread id: 0x2a0
error location
odtextiterator::nextchar(void) [odtextiterator.cpp:418]
odtextiterator::convertfromdxf(char const*,odcodepageid,odfont *,odfont *) [odtextiterator.cpp:621]
odxdataiterator::dxfinitem(oddbdxffiler *) [xdataiterator.cpp:316]
oddbobjectimpl::dxfinxdata(oddbdxffiler *) [dbobject.cpp:1604]
oddbobject::dxfin(oddbdxffiler *) [dbobject.cpp:887]
oddbdxfloader::loadobject(dword) [dbdxfloader.cpp:987]
oddbdxfloader::loadblocks(void) [dbdxfloader.cpp:632]
oddbdxfloader::loaddrawing(void) [dbdxfloader.cpp:226]
oddbdxfloader::enddbloading(void) [dbdxfloader.cpp:95]
oddbdatabase::closeinput(void) [dbdatabaseload.cpp:503]
allocation location
new(uint) [afxmem.cpp:317]
odstring::allocbuffer(int) [odstring.cpp:1085]
odstring::concatcopy(int,char const*,int,char const*) [odstring.cpp:1272]
odstring::concatinplace(int,char const*) [odstring.cpp:1321]
odstring::+=(char) [odstring.cpp:1344]
oddbasciidxffilerimpl::readnext(void) [dbfilerimpl.cpp:1415]
oddbasciidxffilerimpl::readnext(void) [dbfilerimpl.cpp:1479]
oddbasciidxffilerimpl::currentgroupcode(void) [dbfilerimpl.cpp:1442]
oddbasciidxffilerimpl::atendofobject(void) [dbfilerimpl.cpp:1087]
oddbobjectimpl::dxfinxdata(oddbdxffiler *) [dbobject.cpp:1602]
breaking in the assembly code when the crash happens shows that the error is happening in dd_db.dll and i can see that it is trying to read one byte past the end of an array. if this is a valid address then the program survives, if it's an invalid address then the program dies.
the instruction that causes the error is at an offset of 26eb7e from the start of the dll. this loads into 0x0067eb7e when the program is running.
this is a fairly major problem for us because it is causing random crashes.
are you using dd dlls from borland?
sergey slezkin
no - they're the ms compiler dlls
is your platform msvc 6?
sergey slezkin
yes - i'm using msvc6
dwgdirect dlls are supposed to work with msvc projects with non-default struct member alignment but maybe something got broken.
try to set it to 8 in your project.
sergey slezkin
hello,
the struct alignment value is always set to 8 when we compile our code.
we believe that the purify report seems to shows that the code is trying to read the 46th character of a newed array of only 45 characters on line 418 of odtextiterator.cpp.
checking register values in the debugger shows that the code is definitely reading past the end of the array - sometimes from an invalid address.
could you post or e-mail me the dxf file you used in your test (showing results above)?
sergey slezkin
hi,
there should be a file attached to this post. i got similar purify results from most of the files that my unit tests read.
attached files (56.5 kb, 3 views)

thanks. we'll check the file you posted. but have you upgraded to 1.10 or 1.10 update? similar problem was fixed between 1.10 and 1.10 update releases.
sergey slezkin
sorry, i didnt know there was an update - i'm still using the original version 1.10. i'll download the update and see what results i get.
hi there,
i've rebuilt our applicaton using the version 1.10 update libs/dlls and rerun our unit tests. purify now reports no abrs and i cant reproduce the crashes. sorry to have wasted your time.
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】naming convention of dlls cause problems yang686526 DirectDWG 0 2009-05-06 06:19 PM
【转帖】dlls for vs .net 2003 yang686526 DirectDWG 0 2009-05-04 07:58 PM
【转帖】dll学习(资料收集) huangyhg vc编程 0 2008-05-17 09:24 PM


所有的时间均为北京时间。 现在的时间是 11:05 AM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多