GithubHelp home page GithubHelp logo

highway's People

Contributors

dalance avatar mattn avatar presuku avatar tkengo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

highway's Issues

Segmentation fault with pipe (Array index out of bounds)

I found segmentation fault with following operation.
( "man gcc" is enough large to cause segmentation fault in this case. :) )

$ hw --version
highway version 1.1.0
$ man gcc | hw hoge
Segmentation fault (core dumped)
$ man gcc | wc
  15597  101199  822142

It seems that the "search" function has the out of bounds access to array.
Please check the followings.

Segmentation fault happens in line 424.
The "read_sum" can become larger than NMAX by addition in line 416.

    392 int search(int fd,
    393            const char *pattern,
    394            int pattern_len,
    395            enum file_type t,
    396            match_line_list *match_lines,
    397            int thread_no)
    398 {
    399     char eol = '\n';
    400     size_t line_count = 0;
    401     size_t read_sum = 0;
    402     size_t n = NMAX;
    403     ssize_t read_len;
    404     int buf_offset = 0;
    405     int match_count = 0;
    406     bool do_search = false;
    407     char *buf = (char *)hw_calloc(n + 1, SIZE_OF_CHAR);
    408     char *last_new_line_scan_pos = buf;
    409     char *last_line_end;
    410 
    411     if (!op.use_regex) {
    412         prepare_fjs(pattern, pattern_len, t);
    413     }
    414 
    415     while ((read_len = read(fd, buf + buf_offset, NMAX)) > 0) {
    416         read_sum += read_len;
    417 
    418         // Search end position of the last line in the buffer. We search from the first posi    418 tion
    419         // and end position of the last line.
    420         size_t search_len;
    421         if (read_len < NMAX) {
    422             last_line_end = buf + read_sum;
    423             search_len = read_sum;
    424             buf[read_sum] = eol;
    425         } else {

list filename which is match the patten?

Thanks for sharing the project, now I want to use hw as ctrlp.vim's user_command, so I need the feature just like ag's -g option, will you support it? or does the latest version of hw support it?

What are the advantages of highway over ag?

The silver searcher is already great, I stumbled upon your project and wondered what its advantages were over something as developed as the silver searcher (ag).
Is it the UTF-8 support?

文字列の長さによって検索が行なえません

$ hw a

Searchable

$ hw hoge

hw(38555,0x7fffe19753c0) malloc: *** malloc_zone_unregister() failed for 0x7fffe196b000
  • hard
    macbook pro 2016

  • os
    10.12.2

  • highway version
    $ hw --version

hw(38648,0x7fffe19753c0) malloc: *** malloc_zone_unregister() failed for 0x7fffe196b000
highway version 1.1.0

Intermittent segfaults

When searching a reasonably large directory tree (~8GB, 19M lines of code), using simple pattern matching (no flags) I get segfaults at least half the time.

system:
Darwin 14.5.0 Darwin Kernel Version 14.5.0: Tue Sep 1 21:23:09 PDT 2015; root:xnu-2782.50.1~1/RELEASE_X86_64 x86_64

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.