title: CFMutableAttributedString crashing when running on device (EXC_BAD_ACCESS)
body: <p>I have the following code:</p>
  
  <pre><code>NSString *name = @"some text goes in here";
  
          CFStringRef string =  (__bridge CFStringRef) self.highlightItem_.comment;
          CFMutableAttributedStringRef comment = CFAttributedStringCreateMutable(kCFAllocatorDefault, 0);
          CFAttributedStringReplaceString (comment ,CFRangeMake(0, 0), string);
  
          CGColorRef blue =[UIColor colorWithRed:128/255.f green:203/255.f blue:255/255.f alpha:1.0].CGColor;
          CGColorRef gray =[UIColor colorWithWhite:153/255.f alpha:1.0].CGColor;
  
          CFAttributedStringSetAttribute(comment, CFRangeMake(0, [name length]),kCTForegroundColorAttributeName, blue);
          CFAttributedStringSetAttribute(comment, CFRangeMake([name length],  [self.highlightItem_.comment length] - [name length]),kCTForegroundColorAttributeName, gray);
  
          CTFontRef nameFont = CTFontCreateWithName((__bridge CFStringRef)kProximaNovaBold, 15.0f, nil);
          CFAttributedStringSetAttribute(comment,CFRangeMake(0, [name length]),kCTFontAttributeName,nameFont);
  
          CTFontRef commentFont = CTFontCreateWithName((__bridge CFStringRef)kProximaNova, 15.0f, nil);
          CFAttributedStringSetAttribute(comment, CFRangeMake([name length],  [self.highlightItem_.comment length] - [name length]),kCTFontAttributeName,commentFont);
  
          CGContextSaveGState(context);
          CGRect captionFrame = CGRectMake(0, 0, rect.size.width - 80, commentHeight);
          CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString(comment);
          CGMutablePathRef captionFramePath = CGPathCreateMutable();
          CGPathAddRect(captionFramePath, NULL, captionFrame);
  
          CTFrameRef mainCaptionFrame = CTFramesetterCreateFrame(framesetter, CFRangeMake(0, 0), captionFramePath, NULL);
  
          CGContextRef context = UIGraphicsGetCurrentContext();
          CGContextSetTextMatrix(context, CGAffineTransformIdentity);
          CGContextTranslateCTM(context, 70, self.imageHeight_ + commentHeight + 20);
          CGContextScaleCTM(context, 1.0, -1.0);
  
          CTFrameDraw(mainCaptionFrame, context);
          CGContextRestoreGState(context);
  
          CFRelease(framesetter);
          CGPathRelease(captionFramePath);
  </code></pre>
  
  <p>I am not sure why when I run it on the simulator it all worked fine, but when I run it on the device, it crashes on this line:</p>
  
  <pre><code>CFAttributedStringSetAttribute(comment, CFRangeMake(0, [name length]),kCTForegroundColorAttributeName, blue);
  </code></pre>
  
  <p>any idea why?</p>