Closed
Bug 569611
Opened 14 years ago
Closed 14 years ago
hunspell compilation failure on mingw-w64 due to pointer to long cast loosing precision.
Categories
(Core :: Spelling checker, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: jacek, Unassigned)
References
Details
(Whiteboard: [fixed-in-hunspell-1.2.12])
Attachments
(1 file, 2 obsolete files)
1.27 KB,
patch
|
Details | Diff | Splinter Review |
I get following errors:
extensions/spellcheck/hunspell/src/csutil.cpp:290:40: error: cast from 'char*' to 'long unsigned int' loses precision
extensions/spellcheck/hunspell/src/csutil.cpp:290:60: error: cast from 'char*' to 'long unsigned int' loses precision
extensions/spellcheck/hunspell/src/dictmgr.cpp:179:39: error: cast from 'char*' to 'long unsigned int' loses precision
extensions/spellcheck/hunspell/src/dictmgr.cpp:179:59: error: cast from 'char*' to 'long unsigned int' loses precision
These casts are used for char pointer subtraction. They are not needed at all as char is of 1 byte size, subtracting pointers will give expected value.
Reporter | ||
Updated•14 years ago
|
Attachment #448771 -
Attachment is patch: true
Attachment #448771 -
Flags: review?(jst)
Comment 1•14 years ago
|
||
Yeah, fix checked in upstream for hunspell 1.2.12
Comment 2•14 years ago
|
||
Comment on attachment 448771 [details] [diff] [review]
fix v1.0
if (dp) {
*stringp = dp+1;
- int nc = (int)((unsigned long)dp - (unsigned long)mp);
+ int nc = dp - mp;
Are there any guarantees that dp - mp fits in a 32-bit int here? Seems like nc should a size_t here to be sure, or explicit length checks need to ensure that this will never overflow.
Reporter | ||
Comment 3•14 years ago
|
||
It's not really the problem my patch is solving, but the attached version uses size_t. If we're going to take it into account, the result of strlen should be stored in size_t as well. Also one of pointer subtractions isn't needed at all as we already have the pointer we want.
Attachment #448771 -
Attachment is obsolete: true
Attachment #449766 -
Flags: review?(jst)
Attachment #448771 -
Flags: review?(jst)
Comment 4•14 years ago
|
||
Yeah, its size_t upstream for these ones, should probably be size_t more generally in more places, but that's not the exact problem mentioned here which was getting it to compile in the first place :-)
Updated•14 years ago
|
Whiteboard: [fixed-in-hunspell-1.2.12]
Reporter | ||
Comment 5•14 years ago
|
||
The patch rebased against current m-c.
Attachment #449766 -
Attachment is obsolete: true
Attachment #450090 -
Flags: review?(jst)
Attachment #449766 -
Flags: review?(jst)
Reporter | ||
Comment 6•14 years ago
|
||
Caolan, thanks for mainstreaming it. What's the next step? Can this patch be checked into m-c or should we wait for the next merge? If we should wait, is there any ETA for merge?
Comment 7•14 years ago
|
||
My plan was to wait for the next release to get it into the tree.
Comment 8•14 years ago
|
||
This is fixed now that 1.2.12 has landed on trunk.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Reporter | ||
Updated•14 years ago
|
Attachment #450090 -
Flags: review?(jst)
You need to log in
before you can comment on or make changes to this bug.
Description
•