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)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jacek, Unassigned)

References

Details

(Whiteboard: [fixed-in-hunspell-1.2.12])

Attachments

(1 file, 2 obsolete files)

Attached patch fix v1.0 (obsolete) — 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.
Attachment #448771 - Attachment is patch: true
Attachment #448771 - Flags: review?(jst)
Yeah, fix checked in upstream for hunspell 1.2.12
Blocks: 570342
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.
Attached patch fix v1.1 (obsolete) — Splinter Review
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)
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 :-)
Whiteboard: [fixed-in-hunspell-1.2.12]
The patch rebased against current m-c.
Attachment #449766 - Attachment is obsolete: true
Attachment #450090 - Flags: review?(jst)
Attachment #449766 - Flags: review?(jst)
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?
My plan was to wait for the next release to get it into the tree.
Depends on: 579649
This is fixed now that 1.2.12 has landed on trunk.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Attachment #450090 - Flags: review?(jst)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: