brintos

brintos / llvm-project-archived public Read only

0
0
Text · 687 B · bcb15d8 Raw
24 lines · plain
1// Regression test for2// https://code.google.com/p/address-sanitizer/issues/detail?id=274.3 4// RUN: %clang_asan %s -framework Foundation -o %t5// RUN: %run %t 2>&1 | FileCheck %s6#import <Foundation/Foundation.h>7 8#include <stdio.h>9 10int main() {11  NSString* version_file = @"MAJOR=35\n";12  int major = 0, minor = 0, build = 0, patch = 0;13  NSScanner* scanner = [NSScanner scannerWithString:version_file];14  NSString *res = nil;15  if ([scanner scanString:@"MAJOR=" intoString:nil] &&16      [scanner scanInt:&major]) {17    res = [NSString stringWithFormat:@"%d.%d.%d.%d",18           major, minor, build, patch];19  }20  printf("%s\n", [res UTF8String]);21  // CHECK: 35.0.0.022  return 0;23}24