[Liblas-devel] Fix for the bug that liblas cannot open some Lidar files

Howard Butler hobu.inc at gmail.com
Wed Oct 5 16:03:43 EDT 2011

On Oct 5, 2011, at 12:38 PM, Hongwei Shen wrote:

> Hello,  Folks,
> Recently I couldn't open some Lidar (.las) files using liblas. I
> debugged for the problem and changed two lines of codes fix it.
> I changed line  362 and 363 in liblas\1.7.0b\src\detail\reader\header.cpp :
>        vlr.SetUserId(std::string(vlrh.userId));
>        vlr.SetDescription(std::string(vlrh.description));
> The above two lines should be changed to:
>        vlr.SetUserId(std::string(vlrh.userId, 16)); // Length of
> userId is 16 in the header
>        vlr.SetDescription(std::string(vlrh.description, 32)); //
> Length of userId is 32 in the header
> The problem is ---  Header::ReadVLRs() assumes “user_id” and
> “description”  are null-terminating string in the header of lidar
> file, which is not always true.  For example, some Lidar files use
> blank spaces at the end of real "user_id" to fill a length of 16
> bytes.
> I could be able to open these Lidar files using liblas after I changed
> the code.
> I don't know how to change source code of liblas or submit bugs
> online.  So I'm sending this email.   Can someone integrate my changes
> into liblas code?
> Thanks,
> Hongwei Shen

Thanks Hongwei,

Thank you for the report, and I have integrated a patch that does what you have suggested. One way that you can provide these yourself is to create a github account, "fork" the liblas repository, and then commit your changes to your own fork of the liblas repository. After that, you can click on "Pull Request" and we will be notified of a suggested patch that we can choose to integrate at will or modify and integrate into the library.



More information about the Liblas-devel mailing list