erlang:split_binary(Bin, N)的BUG

OS运行平台:

 

root@x61-laptop:~# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=8.10
DISTRIB_CODENAME=intrepid
DISTRIB_DESCRIPTION="Ubuntu 8.10"



 

 

ERLANG版本:

 

root@x61-laptop:~# cat /usr/lib/erlang/releases/RELEASES
[{release,"OTP  APN 181 01","R12B","5.6.3",
          [{kernel,"2.12.3","/usr/lib/erlang/lib/kernel-2.12.3"},
           {stdlib,"1.15.3","/usr/lib/erlang/lib/stdlib-1.15.3"},
           {sasl,"2.1.5.3","/usr/lib/erlang/lib/sasl-2.1.5.3"}],
          permanent}].


 

 

操作过程:


Eshell V5.6.3  (abort with ^G)
1> CaptureFile = <<212,195,178,161,2,0,4,0,0,0,0,0,0,0,0,0,96>>.
<<212,195,178,161,2,0,4,0,0,0,0,0,0,0,0,0,96>>

2> A = split_binary(CaptureFile, 1).
{<<"\324"
>>,<<195,178,161,2,0,4,0,0,0,0,0,0,0,0,0,96>>}

3> B = split_binary(CaptureFile, 3).
{<<"\324\303\262"
>>,<<161,2,0,4,0,0,0,0,0,0,0,0,0,96>>}

4> C = split_binary(CaptureFile, 4). 
{<<"\324\303\262\241"
>>,<<2,0,4,0,0,0,0,0,0,0,0,0,96>>}

5> D = split_binary(CaptureFile, 5).
{<<212,195,178,161,2>>,<<0,4,0,0,0,0,0,0,0,0,0,96>>}

6> E = split_binary(CaptureFile, 6).
{<<212,195,178,161,2,0>>,<<4,0,0,0,0,0,0,0,0,0,96>>}

7> 




 

 

这说明split_binary(Bin, N)函数的N如果小于5,则会出错误。

如果Bin超过128M也会出错。

 

 

还有<<"\324\303\262\241">> 是怎么产生的?

 

 

你可能感兴趣的:(erlang,OS,ubuntu)