Closed Bug 463561 Opened 12 years ago Closed 12 years ago

mkdepend crashes while compiling freetype

Categories

(Firefox Build System :: General, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: blassey, Assigned: blassey)

Details

(Keywords: fixed1.9.1, mobile)

Attachments

(1 file, 1 obsolete file)

It also crashes when compiling other sources that include freetype headers.  For some reason we're dividing by zero when parsing some macros.
Attached patch fixes the crash (obsolete) — Splinter Review
instead of dividing by zero, set the result to the largest integer it can hold
Attachment #346839 - Flags: review?(benjamin)
What file is being compiled when mkdepend crashes? I'm a little leery of changing the mkdepend sources independently, since I'm pretty certain it is a straight import of external code (FreeBSD stuff, perhaps?)
CVS logs say it's from X11, but they also say we've taken local patches:
http://bonsai.mozilla.org/cvslog.cgi?file=mozilla/config/mkdepend/main.c&rev=HEAD&mark=3.7
It appears to crash anywhere ftconfig.h is included, while evaluating "FT_SIZEOF_INT  (32 / FT_CHAR_BIT)."  So there are two bugs here.  First being FT_CHAR_BIT is defined to be 0, which is wrong.  It appears to expect CHAR_BIT to be defined in <limits.h>

  /* `CHAR_BIT' (defined in limits.h) gives the number of bits in a      */
  /* `char' type.                                                        */

#ifndef FT_CHAR_BIT
#define FT_CHAR_BIT  CHAR_BIT
#endif


The second problem being that mkdepend crashes when it encounters this, giving no useful error message.
Comment on attachment 346839 [details] [diff] [review]
fixes the crash

Yeah, I don't think this is the right solution.
Attachment #346839 - Flags: review?(benjamin) → review-
Without this patch (and just using the CHAR_BIT=8 patch in Makefile.in), i continue to crash when building cairo.
Attachment #346839 - Flags: review- → review?(benjamin)
Comment on attachment 346839 [details] [diff] [review]
fixes the crash

Benjamin, what do you think the right solution is?
I think the right solution is for mkdepend to report an error if you try to divide by zero.
Attachment #346839 - Attachment is obsolete: true
Attachment #358419 - Flags: review?(benjamin)
Attachment #346839 - Flags: review?(benjamin)
Attachment #358419 - Flags: review?(benjamin) → review+
Comment on attachment 358419 [details] [diff] [review]
throws an error for division by zero

a191=beltzner
Attachment #358419 - Flags: approval1.9.1+
pushed http://hg.mozilla.org/mozilla-central/rev/700fe6e76517
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Why hasn't this landed on branch yet?
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.